Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have two folders /tmp/logs and /home/tmp/
/tmp/logs has 50 files already in it.
I want to move all the files to /home/tmp and also when a new file is created in /tmp/logs it gets created to /home/tmp instead.
So /tmp/logs just exist as a folder but nothing gets created inside it.
#move /tmp/logs to their new location
mv /tmp/logs /home/tmp
#replace the original /tmp/logs with a link to /home/tmp
ln -s /home/tmp /tmp/logs
Now whenever a program requests the kernel that anything be done in /tmp/logs, the kernel will see it's a symbolic link and will instead act on the corresponding file in /home/tmp (what the link points to).
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have /home/eric/public_html with drwxr-x--- eric:nobody as the mod and ownership.
I login with eric so I cannot recreate this folder without root access, since eric is not part of the nobody group.
I want to replace my public_html with a symbolic link (i.e. ln -s ~/git/project/src ~/public_html) but if I do that, my new public_html ends us without the correct permissions.
Is there a trick to get around this without contacting my admin?
Possibly by doing the following:
Copy everything from ~/git/project/src into ~/public_html
mv ~/git/project/src ~/git/project/src2 to get it out of the way
mv ~/public_html ~/git/project/src
finally link it back: ln -s ~/git/project/src ~/public_html
The idea is to keep the original public_html directory because it has the correct owner/permissions, but reuse it as the link target.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have my home directory in /home/tom.
In another partition I have a folder called /data/tomhome.
Basically, I copy all of my data from /data/tomhome to /home/tom
But whenever I update files in /data/tomhome, I still have to copy them to the other directory.
Another way will be to symlink all files but i don't want to make 20 symlinks.
Is there any other way for this?
Try
ln -s /home/tom /data/tomhome
Note: You should delete the directory /data/tomhome with rm -rf /data/tomhome if it exists already
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Looking to zip up a folder on my linux box ie zip -r9 test /var/www/html/ where does that resulting test.zip file end up? in my pwd? I still want to leave the contents of /var/www/html intact.
Yes, it creates zip in your current working directory.
True is that you are free to specify relative or absolute paths like you wish.
zip test.zip path/to/files
will place test.zip in the current working directory.
zip /foo/bar/test.zip path/to/files
will place test.zip in /foo/bar
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I'm currently using rsync as follows
rsync -az --delete ...
What option can I use with rsync to replace all destination files that already exist except for one specific file that should not be replaced if already exists? Sure, if the file doesn't exist at the destination, it should be put there.
I don't know whether it is possible in one invocation, but you could call rsync twice:
rsync ... --ignore-existing file dest
Now the file is put there if it didn't exist before.
rsync ... --exclude file src dest
Now all the other files are handled as usual, except for the one excluded file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I want to copy folder ajax_search, path: /home/thejobco/public_html/JCCore/ajax_search/ to be inside this foler:/home/thejobco/public_html/demo/typo3conf/ext/, should I run command this way:
cp -r /home/thejobco/public_html/JCCore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext/
or
cp -r /home/thejobco/public_html/JCCore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext
I am familiar with window, but not unix/linux, I put / after ajax_search, I know this way ajax_search/, shows ajax_search is a folder, but i do not know should i put / after ext or not? can anyone explain to me which is the right way to copy folder? thanks
With cp, if the destination directory already exists and you do not use a trailing slash on the source-dir, then you are actually putting a copy of source-dir inside dest-dir; this can be a problem when you forgot that the destination directory already exists.
You should include the trailing slash, to make it obvious to cp that you are trying to copy a directory name to a new directory name, and not copy the directory into an existing one, if it exists.