I want to copy all files of a said type on my external hard drive


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I want to copy all files of a said type on my external hard drive
# 1  
Old 09-21-2014
Question I want to copy all files of a said type on my external hard drive

My code is this, what I'm trying to accomplish is to make a list of all pdf documents in my computer and then copy all of those documents to my external hard drive in a directory

Code:
mkdir /Volumes/Hardrive-1/allpdf
 
echo "File Locations" > /Volumes/Hardrive-1/allpdf/FileLocations.txt
mdfind pdf >> /Volumes/Hardrive-1/allpdf/FileLocations.txt
 
find ~/ -iname "*.pdf" -exec cp {} /Volumes/Hardrive-1/allpdf/ \;

When i compile the code and test it, it creates the "allpdf" directory and creates the "FileLocations.txt" file with all the files that contain "pdf" in their names or extensions, but the last part of my code seems to be unable to work and all I get is a "bad path" perhas there's a mistake somewhere? thanks in advance

Last edited by Don Cragun; 09-21-2014 at 07:49 PM.. Reason: Add CODE tags.
# 2  
Old 09-21-2014
Try:

Code:
find ~/ -iname "*.pdf" -print0 | xargs -0 cp -t "/Volumes/Hardrive-1/allpdf/"

# 3  
Old 09-22-2014
Doesn't work

It doesn't work and only returns this Smilie :


Code:
mkdir: /Volumes/D-MEM/D: File exists
find: /Users/my_username//Library/Application Support/Firefox/Profiles/na6g9efh.default/jetpack: Permission denied
find: /Users/my_username//Library/Saved Application State/com.adobe.flashplayer.installmanager.savedState: Permission denied

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

External hard drive

I have connected an external hard drive. I can't find it. Both ls /media, fdisk -l and ls /dev show nothing. TIA (3 Replies)
Discussion started by: Meow613
3 Replies

2. UNIX for Dummies Questions & Answers

Copy everything from remote Linux to external hard drive in windows

Hi, I`m trying to copy an entire directory(with numerous files, folders and subfolders etc, a content size of 500gigs) from a linux machine running Red Hat Enterprise Linux 6 to an external hard drive on my windows. I downloaded and installed psftp on my windows and I can login using psftp... (9 Replies)
Discussion started by: newbie83
9 Replies

3. Ubuntu

How to install Ubuntu11 in external Hard drive

Hi Guys.. I want to install Linux on my portable hard drive. I created a 20GB partition in my hard drive for linux, Now I want to make it bootable mean when I connect it to system n start the system it will start the LINUX and when start without usb-hard drive it should start the windows. ... (3 Replies)
Discussion started by: atul9806
3 Replies

4. Solaris

Boot Solaris off of an old external hard drive

Hi Folks, First a little background, I am working on a ship that operates in the Indian Ocean and Persian/Arabian gulf area. We had a Sunblade 2000 that finally died. The Video board burned up and I guess damaged the mother board. So we ordered 2 rebuilt 2000s one as a spare. Due to mounting... (1 Reply)
Discussion started by: Sean.kelly
1 Replies

5. HP-UX

Mounting an external parallel hard drive

Can anyone please walk me through how to mount an external parallel (or scsi) hard drive in visualize C3000 machine? I also would like to mount "/var/sallie" directory in that external drive. My "/var/sallie" directory is running out of space so I would like to mount an external hard drive so that... (0 Replies)
Discussion started by: sallysallie
0 Replies

6. Ubuntu

External Hard drive won't mount

i have a Simple Tech hard drive that i use between two computers. it is formatted to ntfs. i have a dell desktop with Ubuntu 7.10 and Ubuntu 8.04 and Windows XP Home. and i have a laptop with Ubuntu 7.10 and Ubuntu 8.04. the laptop recognizes the hard drive on both 8.04 and 7.10 but my desktop... (9 Replies)
Discussion started by: Texasone
9 Replies

7. UNIX for Dummies Questions & Answers

External SCSI hard drive

Someone gave me a small external SCSI hard drive for my SunOS 5.8 test system. How do I make Unix see the hard drive? (2 Replies)
Discussion started by: FredSmith
2 Replies

8. Solaris

FAT32 usb external hard drive - how to mount??

Hello ! What is the comand to mount and usb hard disk ? I have Solaris 10 installed! 10nx! (1 Reply)
Discussion started by: daniel.balasa
1 Replies

9. UNIX for Dummies Questions & Answers

How do copy certain files and directories from one hard drive to another?

I have two drives (scsi) mounted on one server and I need to copy certain files and directories from one drive to the other. Any suggestions :confused: (4 Replies)
Discussion started by: shorty
4 Replies

10. UNIX for Dummies Questions & Answers

listing directories of an external hard drive

How do I do it? I have a mac and a pc and am having a time cd-ing to the external drive. (2 Replies)
Discussion started by: theGooch
2 Replies
Login or Register to Ask a Question