so I'm having trouble with moving my file into a subdirectory. Right now I have a jpg file in my Downloads folder that I want to move over to my images folder, which is contained inside my Desktop and odin-links-and-images folders. Just for a bit of clarification, my Downloads folder is a completely separate directory, and I want to move the jpg file inside my Downloads folder to
Desktop/odin-links-and-images/images
What I've tried so far is doing the following command inside my Downloads directory:
mv dog.jpg images/
Doing this, I ended up getting the error:
mv: cannot move 'dog.jpg' to 'images/': Not a directory
I assume this is because my dog.jpg file is in my Downloads folder, which is a completely separate directory from my Desktop/odin-links-and-images/images directory. I'm not sure if it's possible to move my jpg file, but I'd appreciate any guidance on how to do this!
Write the complete path to images:
mv dog.jpg ~/Desktop/odin-links-and-images/images
This is assuming Desktop is in home. Otherwise, use whatever is the full path to desktop.
Related
I have a folder that I downloaded all my fonts to. When I opened the folder i noticed they were saved out into subfolders.
Is there a bash-shell script to grab all the files within the subfolders and move them to the parent folder?
You can move files with same extensions recursively using the wildcards. e.g. if you want to move all log files in nested folders under log/ directory into backup/ directory, you can use the following command:
mv log/**/*.log backup/
Im having trouble in Bash.
I have plain files in a directory on my desktop. I am trying to move them into a subdirectory within that directory using: mv "Filename" /"Directoryname"
However when I use this command, I get an error telling me that the permission was denied.
I am set as the owner of both directories and have should have full permissions. If there is anything I need to provide you to make it easier for you to help me, I will be glad to help.
Try mv filename subDirectoryName/.
By placing / in front of the directory name in a move sequence, you're telling the shell that you would like it to be placed in a high level folder named /folder.
What you want is a sub-directory within your current directory. As you would usually move directories in bash, ../ goes up one directory, and directory/ implies you are moving into a folder that is within your current directory.
Compressing a folder into a .zip file is a common way to treat a folder as file, for example, uploading a folder. Is there a faster way to "pack" the contents of a folder into a file (without taking the time to compress)?
You should use a tarfile. In unix or mac, its the tar command. On Windows there is a tool called 7-zip.
You can see more details here.
I have two subdomains of a website and in both accounts one folder is there with several sub folders. It's a photo folder. In dirA.xyz.com photo folder consists of several folders and sub folders and in dirB.xyz.com photo folder consists of new photos which are not available in dirA. But the sub folder name in dirA photo folder may be the same as dirB photo folder but the final name of image will be different. So I want to move all files of dirB photo folder to dirA photo folder without deleting the dirA photo folder data.
As the name and folder structure varies and data is in millions how to move them and merge so that all data remains?
I've tried using zip. I zipped the photo folder of dirB, moved it to dirA and tried to unzip it but it's not going in dirA photo folder, it's going in dirB photo folder. I've tried changing the owner of dirB photo folder to dirA owner but it also did not work. The only thing that is working is the move command so how can I achieve this with mv?
mv /home/xyz/public_html/photo/ABC/Something/something/xyz.jpg /home/ABCDE/public_html/photo/ABC/Something/something/xyz.jpg
All files are jpeg or png.
Sounds like you need rsync, with the merge option, not overwrite. If you are using any decent and recent version of linux, you should have rsync installed by default.
source: /home/xyz/public_html/photo/ABC/Something/something/xyz.jpg
target: /home/ABCDE/public_html/photo/ABC/Something/something/xyz.jpg
rsync -avibu --ignore-existing /home/xyz/public_html/photo/ /home/ABCDE/public_html/photo
On this command I selected the top level directory randomly. You may want to modify according to your needs. Also pay attention to the trailing "/" on both source and destination. Otherwise, placement of files might be a level of directory off.
-b makes rsync backup files that exist in both folders, appending ~ to the old file. You can change the ~ suffix with --suffix string_of_your_choice
-u makes rsync transfer skip files which are newer in destination than those in source
What is the AppleScript to compress a folder? Not let the user select a folder from the dialog but give the folder path on a string variable. The script I know compresses the folder with the full path as folder. For example: if the folder names "ABC" is in this folder location, "Applications:Data:Level" then the compressed folder will create the folder structure like this "Applications:Data:Level:ABC" and put the content. I do not want this one. The compress ApplScript must not maintain this folder structure.
?
If you use zip, cd to the parent directory of the zipped directory first:
do shell script "cd /usr/share; zip /tmp/dict.zip -r dict"
There are no AppleScript commands for creating archives, and Archive Utility is not scriptable.