Automated command ; extracting files from folders and copying them into a single folder


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Automated command ; extracting files from folders and copying them into a single folder
# 1  
Old 05-31-2010
Automated command ; extracting files from folders and copying them into a single folder

Hello everyone,

I'm running Mac OS X Leopard (10.5.8) and I want to use the Terminal to help automate this tedious and laborious command for me:

I need to extract all of the .m4p files in my "iTunes Music" folder which reside in folders of the artist, and then subfolders for the albums and then copy those .m4p files to a single folder elsewhere. I also need to exclude the folders "Movies" and "TV Shows" from the copying process.

Would someone be able to educate me as to how I would go about automating such a task?


Thanks!!

BOSS
# 2  
Old 05-31-2010
Code:
find $HOME/Music/iTunes/iTunes\ Music/ -type f -iname "*m4p" -print0 | xargs -0 -J% cp % /path/to/destination/directory/

You might have to tinker with the iTunes Music path.
# 3  
Old 06-07-2010
This could easily be accomplished with Automator.

I highly recommend going to youtube and check out tutorials, especially for beginners it's a lot easier than getting down to shell scripting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Moving files and folders to another folder

I recently bought Synology server and realised it can run scripts. I would need fairly simple script which moves all files and folders from ARCHIVE folder to WORKING folder. I would also need to maintain folder structure as each of the folders may contain subfolders. How would I go about it as I am... (1 Reply)
Discussion started by: ###
1 Replies

2. UNIX for Dummies Questions & Answers

Copying folders with only certain files

Hello gurus, quick question I have a bunch of folders each having subfolders that have 3 files with the same name but different in content. So I want to copy the subfolders with only those 3 files to another location. Just making up some names here, Folder1 SubfolderX1 SubfolderY1 ... (1 Reply)
Discussion started by: ritakadm
1 Replies

3. Shell Programming and Scripting

Copying files from various folders to similar folder structure in another location

Hi, I need to write a script the has to copy the files from folders and subfolders to the same folder structure located in another location. Ex: mainfolder1 file1,file2,file3 subfolder1(file1,etc) subfolder2(file1,etc) to another folder location of same folder structure. rsync is not... (7 Replies)
Discussion started by: Raji Perumal
7 Replies

4. UNIX for Advanced & Expert Users

Copying excluding some files and folders

I have a main folder. Inside that i have many(50) subfolders. In each subfolder, there are a no of large files(500 files ) present. I want to do copy operation for some files from some of the subfolders to /usr/tmp. I have the list of the subfolders and list of of files which i dont want to... (4 Replies)
Discussion started by: millan
4 Replies

5. Shell Programming and Scripting

Symlink all files from one folder into all found folders

Hi. I have a folder which contains my application. I then have a flexible number of folders in another directory, called “sites”. It looks like this: -Application -- Test.html -- CSS --- Style.css -Sites --Site1 --Site2 I want to symlink all the files in the application folder... (1 Reply)
Discussion started by: Spadez
1 Replies

6. Shell Programming and Scripting

moving files from one folder to many folders

I have a more than 10 K files in a folder. They are accumulated in a period of more than an year (Say from 13th July 2010 to 4th June 2011). I need to perform housekeeping on this. The requirement is to create a folder like 13Jul2010,14July2010,......3June2011,4June2010 and then from the main... (2 Replies)
Discussion started by: realspirituals
2 Replies

7. Shell Programming and Scripting

Move all files but not folders to a new folder

Hi, I have a sub directory with a number of files and folders. What i want is a subdirectory with just folders and not files for cleanliness sake. So I want to move the files into the new folder but keep the folders in the same place. Move all files (but not folders) to new folder. I am... (4 Replies)
Discussion started by: Hopper_no1
4 Replies

8. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

9. UNIX for Dummies Questions & Answers

Copying multiple folders to local machine (don't know folder names)

Hi. I'm trying to copy multiple folders from the remote machine to the local machine. I wrote a batch file to run an ftp window. The problem I am having is that the only command to copy files is mget *, and this copies only files, not folders. For example, ftp ts555 cd ts555/test ' test... (5 Replies)
Discussion started by: leenyburger
5 Replies

10. Shell Programming and Scripting

delete all folders/files and keep only the last 10 in a folder

Hi, I want to write a script that deletes all folders and keep the last 10 recent folders. I know the following: ls -ltr will sort the folders from old to recent. ls -ltr | awk '{print $9}' will list the folder names (with a blank line at the beginning) I want to get the 10th folder from... (3 Replies)
Discussion started by: melanie_pfefer
3 Replies
Login or Register to Ask a Question