New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

How do i extract files from folders??


Post Reply New Thread Subscribe

 
Thread Tools
usmanazim

 
Member Since: Apr 22, 2013
Posts: 1
usmanazim is on a distinguished road

usmanazim is offline
Hi
I have close to 1000 folders with close to 5000 files. Is there a way to extract all files without going to each folder and extracting them to a root folder individually?

This is several days of work that I dont want to do....

Thanks!
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,737
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
Welcome to Mac-Forums.

Unless you have compressed files here, what you are talking about is not extracting, but rather copying files..

You will probably not be able to do what you want from the UI or Finder, but rather through a shell script or something..

For example, assume you have 10 directories with 10 files (named the same to make it complicated) like this:
Quote:
.:
one two three four five six seven eight nine ten

./one:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./two:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./three:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./four:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./five:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./six:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./seven:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./eight:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

./nine:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen

.ten:
fileOne fileTwo fileThree fileFour fileFive fileSix fileSeven fileEight fileNine fileTen
You first get a list of all the files with:
Code:
find . -type f > file.list
Now this script will iterate over each of the files and copy them to the local (root) directory by prefixing the directory name to each file so you know where it came from. I'm only dealing with files one level deep, if you have files that are multi-directory deep, you'll have to modify the script accordingly..

Code:
for file in `cat file.list`; 
do d=`echo $file | sed -e 's/\// /g'`; 
dir=`echo $d | awk '{print $2}'`; 
f=`echo $d | awk '{print $3}'`; 
echo "Moving $file to $dir-$f"; 
mv $file $dir-$f; 
done
You might have to not add the "mv $file $dir-$f" portion of the script and just see what the echo is going to show you to ensure that the files are being moved properly..

Also, you might want to play around with this script in a separate test folder until you're sure it's doing what you want before running it on the real folders..

--
Regards
...Ashwin



Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.
QUOTE Thanks

Post Reply New Thread Subscribe


« Retrieving password | Dictation question. »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Finder v. Windows Explorer - # of Files & Folders nycfonephreak Switcher Hangout 3 01-04-2013 08:50 PM
Missing Folders and Files!! wes1977 OS X - Operating System 4 04-05-2010 07:46 AM
Files and Folders Permission hviado OS X - Operating System 1 06-16-2007 09:41 AM
help me convert something, please. krrose27 Switcher Hangout 4 05-25-2007 03:10 AM

All times are GMT -4. The time now is 05:48 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?