Unzip files in folders automatically [mac os x] [closed] - terminal

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a folder on my desktop that has around 2500 folders in it, each folder has multiple files in them that are zipped, I can unzip them by manually clicking on them, is there a way to do this automatically through terminal?

find ./ -name \*.zip -exec unzip {} \; maybe?

you can try the unzip command, but i think it only works with zip/tar files.
http://www.lifewithtech.net/apple/tip-unzip-multiple-files-into-a-single-directory-in-mac-osx/
http://magma.maths.usyd.edu.au/magma/faq/extract
or if you have the app The Unarchiver:
you can use the open command.
cd to your folder and use:
$ open */*.rar
this should extract all rar files in all sub-folders, according to your Unarchiver setup into a new folder or in the same folder.
Hope this helps.

Related

How to iterate over thousands of tar balls and pull out a single file with .vcf.gz extension? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So I have a directory of thousands of tar balls in Unix. I want to iterate over all those tar balls and extract a specific file (uniquely appended with .vcf.gz), out of each tar ball and move it to a different directory?
I can't figure out how to do this effectively. Please help.
Loop through the tar files in the directory and then perform the tar command on each file.
for i in *tar.gz;
do
tar -xvf "$i" -C "/path/to/new/folder" "*.vcf.gz"; # Use -C to switch directory before extract and put extension to search for in tar file in quotes.
done

Recursively move all files in folders with given name to their parent directory [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a document library where all of my files are in folder based on category name but then they are also all in subfolders called 'pdf' as well. Is there a way in bash to scan through all of the directories in the library and move all files in folders named pdf to their parent directory?
This can be done with a find command.
Assuming you have no other folders named pdf, you could run something like this:
cd path_to_library
find . -type d -name pdf -exec bash -c 'cd {}; mv * ..' ';'

How to remove all folders with foldername X within a directory using osx terminal [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
There is a folder named X located within a number of subfolders of root directory Y. I want to delete all folders named X that are present in Y and all of it's subfolders. I want to do this using osx Terminal.
The folder can be located anywhere downstream of Y at any level, so I want to use a more systematic approach than just using rm -r for every locations I find.
"cd" to root of directory Y
then (assuming the folder name is "X", type in):
"find . -name X -exec rm -rf {} \;" (and be incredibly careful about where you start this "find" from... you only want to do this within your Y directory).
I do this kind of thing all the time to remove old/busted repository directories (like ".svn"), which I suspect is what you may also be doing as well.
And now would probably be a smart time for me to remind you that "Time Machine" is a great thing to have enabled on your Macintosh.

7z zipping directory relatively [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am trying to use 7z to zip a directory so I do
C:/7z a -tzip mydirectory/testing.zip mydirectory/testing -o* -r
The problem the outputted zip file has for the content the entire directory structure path
mydirectory/testing/....
But I want the files under testing to be zipped and not have any paths above reflected in it.
Change the directory to mydirectory/testing first and use * to get all the files.
cd mydirectory\testing
C:\7z.exe a -tzip ../testing.zip * -r

Copy shell script and preserve permissions [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a small shell script that starts a program when I double-click it. (I have set the permissions to allow executing the script).
I want to be able to copy that script to another computer so that the new user can double-click it without needing to know anything about chmod or permissions. But I can't find out how to preserve the execute permission when I copy the file.
I can usually find answers with Google but this has me defeated - I guess I am not expressing my question properly.
Thanks
Use rsync or tar.
rsync -p file user#host:destdir
plus other options you might need.
Or
tar cvzf file.tar file
then copy (or email, etc.) file.tar to the other machine and extract the file:
tar xpvzf file.tar

Resources