Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Shell Script to Move Files between Folders
taylormia
post Feb 18 2009, 04:07 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 3
Joined: 18-February 09
Member No.: 13,913



Hello,

I have a folder/file structure like this:

Folder1/Folder11/file11.avi
Folder1/Folder11/file11.srt
Folder1/Folder12/file12.avi
Folder1/Folder12/file12.srt
.
.
.etc.

I would like to move all the .srt and .avi files into the root Folder1 and delete the subfolders Folder11, Folder12 etc. even if they have contents. The new folder/file structure should look like this:

Folder1/file11.avi
Folder1/file11.srt
Folder1/file12.avi
Folder1/file12.srt


What would a shell script look like to do this?

Also, how would I modify this script if I wanted to move only one file (example: file11.avi) rather than two (example: file11.avi and file11.srt) from the subfolders into the root folder.

What if I want to move three files instead of one or two, from each subfolder into the root folder?

I would appreciate any help.

I am sunning SUSE Linux 11

Thanks
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
michaelk
post Feb 18 2009, 06:41 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



Homework? If so post what you have done so far.
Go to the top of the page
 
+Quote Post
taylormia
post Feb 18 2009, 10:39 PM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 3
Joined: 18-February 09
Member No.: 13,913



QUOTE (michaelk @ Feb 18 2009, 05:41 PM) *
Homework? If so post what you have done so far.

Homework ?? What do you mean ?

I have a large number of media files (>1000) in a folder structure that I need to change to be compatible with a media metadata organizer application. I'm a beginner to scripting and haven't used variables or if..then or for...do type of statements before. I know I need to use these statements to perform the repetitive actions required to find each file and move it to the root folder.

I haven't put together anything yet, but am looking for ideas on how to start.

Thanks.
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 08:29 PM