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,800
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

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: 14th December 2017 - 10:18 AM