Am 15.08.21 schrieb paulie420@21:2/150 in FSX_GEN:
Hallo paulie420,
I have a /directory with 2000 sub-directories... I want to run a script
that goes in every sub-directory, zips the contents to a zip file with a name of that sub-directory, while adding a .ans file, then copying the .zip I created to the main /directory, and rm -r'ing the zipped sub-directory... :P
Hmm, I have not tested the following lines, but something like that comes
in my mind:
for i in *; do
if [ -d "$i" ]; then
zip /"$i".zip "$i"/* jp20topaz.ans
fi
rm -R "$i"
done
I'm not sure about if the syntax of the "if" line is correct, but my idea
-or the pseudo-code for the above- is:
* For every file/dir in the current directory
* check if it is a directory
* zip all files in that dir + the .ans file to a file named after the
directory, but in the root directory
* remove directory
If the directory has subdirectories, the zip command maybe has to get some more parameters, also if the zip file should be "flat".
The "" around $i make sure that dirs with spaces in the names are treated correctly.
I hope that helps a little :)
Regards,
Anna
--- OpenXP 5.0.50
* Origin: Imzadi Box Point (21:3/127.1)