I would like to zip a directory, but I need to use a full path and I need that the zip files starts in the directory, not in /
.
That question was solved here: Command to zip a directory using a specific directory as the root
The answer would be basically to use this: If I want to zip full/path/to/directory/
in a file named myFile.zip, I would need to use the command
cd /full/path/to/ && zip -r myFile.zip directory/
Now, my question: is this threadsafe? without &&
(2 commands) would be unsafe, is &&
enough to make it threadsafe?
Saying command1 && command2
implies that command2
would be executed only if command1
exits with a return code of zero. If /full/path/to/
doesn't exist than the zip
command wouldn't be executed.
Regarding the thread safety part, if you have multiple processes trying to create a file with the same name in a given directory, chances are that it'll lead to unexpected results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.