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
Related
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
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 * ..' ';'
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.
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
How do I navigate using a symlink?
I created a symlink, let's say 'projects' to my '/Desktop/Work/Projects' folder. So if I type 'ls' in my root directory, I see a bunch of things, the symlink among them. 'cd projects' fails with the error:
-bash: cd: projects: No such file or directory
The symlink is broken. If by 'your' /Desktop/Work/Projects you mean /home/youruser/Desktop/Work/Projects, then that's the path you should symlink to:
ln -s "/home/youruser/Desktop/Work/Projects" "/home/youruser/projects"
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