Using Copy Command Without Preserving Directory Structure

#1

Is there a way to download all the files from a remote and path without keeping the file structure of directories?

My situation is the following.

I want to download all the files from driveCrypt:Images/Screenshots/Anime. Inside this path, there's:

dir1
 - image1.jpg
 - image2.jpg
 - image3.jpg

dir2
 - image4.jpg
 - image5.jpg
 - image6.jpg

dir3
 - image7.jpg
 - image8.jpg
 - image9.jpg

I want to download all these images to a local directories so it looks like this:

downloadDir
 - image1.jpg
 - image2.jpg
 - image3.jpg
 - image4.jpg
 - image5.jpg
 - image6.jpg
 - image7.jpg
 - image8.jpg
 - image9.jpg
#2

Not directly. You could mount the remote and copy them out pretty easily though.

1 Like
#3

You aren't the first person to ask for this... What is your use case?

1 Like
#4

I had a script that used to upload screenshots in a Screenshots directory and it was supposed to contain the screenshots only (no other subdirectories). Something happened to that script that it started uploading one directory for each screenshot, so if there were 500 screenshots, there were 500 directories and each one contained a single file.

I solved this by mounting my Drive like @calisro suggested and then used this command to download them all locally without the unnecessary dirs:

find . -type f -exec cp {} /Users/andyibanez/Desktop/gImages \;
2 Likes