Sponsored Content
Top Forums Shell Programming and Scripting Script to move files in multiple folders Post 302758483 by Yoda on Saturday 19th of January 2013 05:56:38 PM
Old 01-19-2013
Here is a bash script:
Code:
#!/bin/bash

c=1; d=1; mkdir -p dir_${d}

for xml_file in *.xml
do
        if [ $c -eq 501 ]
        then
                d=$(( d + 1 )); c=0; mkdir -p dir_${d}
        fi
        echo mv "$xml_file" dir_${d}/
        c=$(( c + 1 ))
done

Note: Remove the highlighted echo if the output looks good.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

moving multiple folders/files in subversion using bash script

Hi, I'm new here an dlearning a lot from this forum. i didnt find any solution for this in the forum. I have already checked in folders in subversion named HTT01,... HTT21.. and have files in each folder like below: HTT01/HTT01_00000.hex HTT01/HTT01_00000_fb_result.hex... (2 Replies)
Discussion started by: ravishan21
2 Replies

2. UNIX for Dummies Questions & Answers

Move folders containing certain files

Hello, How can I move just the folders that contains files modified n days ago? Source tree: |-- SourceFolder | |-- Subfolder1 | | |-- file1.dat | | `-- file2.dat | |-- Subfolder2 | | |-- filea.dat | | `-- fileb.dat Destination tree: |-- ... (3 Replies)
Discussion started by: xavix
3 Replies

3. Shell Programming and Scripting

Shell script to move files to 3 different folders

Hi guys: I've got this problem, I want to move a bunch of files to 3 different folders, without any specific order, and I'm trying to automatize it with a shell script. I'm a newbie at shell scripting so this is my first try: #!/bin/bash COUNTER=`ls -1 | wc -l` while do ARRAY=(... (11 Replies)
Discussion started by: wretchedmike
11 Replies

4. Shell Programming and Scripting

Move files to Folders

Hi Friends, Below is my requirement and i am not clear how to approach this issue in unix programming. I have a folder with 2500 files. The files are in below format. 1234_name1.txt 1234_name123.txt 4567_name1.txt 4567_name123.txt and i need a program which will read each file from this... (5 Replies)
Discussion started by: diva_thilak
5 Replies

5. Shell Programming and Scripting

Help with auto-detect new files/folders then zip and move script

Hello, I need a simple script to Auto-detect new files and folders in the directory. And then I need to zip the new files and bzip2 new folders and move them out of that folder where I am detecting changes to the other folder. Remember, I need simple one. If anyone could do it fast, I may... (1 Reply)
Discussion started by: juzt1s
1 Replies

6. 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

7. UNIX for Advanced & Expert Users

Move folders from Multiple remote Servers to my local computer

I have 20 Servers (They are Windows 2003) that I remote every day using names or IP address and type in my username & Password then copy folders manually to my local computer. I'm wondering if i can just run script(s) from my local computer to do this job without using FTP(because of security... (5 Replies)
Discussion started by: idiazza
5 Replies

8. Shell Programming and Scripting

Shell Script to delete files within a particular time frame under multiple sub folders

Greetings! I'm looking for starting information for a shell script. Here's my scenario: I have multiple folders(100) for example: /www/test/applications/app1/logs /www/test/applications/app2/logs Within these folders there are log files files that need to be deleted after a month. ... (3 Replies)
Discussion started by: whysolucky
3 Replies

9. Shell Programming and Scripting

Move only folders and skipping files

How do I move all folders and its contents from a directory A to another directory B, skipping all files in Directory A ? ---------- Post updated at 12:53 PM ---------- Previous update was at 12:42 PM ---------- Ok. Got it. mv /A/*/ /B/ (1 Reply)
Discussion started by: DHeisenberg
1 Replies

10. Shell Programming and Scripting

Move multiple files 4rm Source to different target folders based on a series num in the file content

Dear Experts my scenario is as follows... I have one source folder "Source" and 2 target folders "Target_123456" & "Target_789101". I have 2 series of files. 123456 series and 789101 series. Each series has got 3 types of fiels "Debit", "Refund", "Claims". All files are getting... (17 Replies)
Discussion started by: phani333
17 Replies
NEW(1)								     [nmh-1.5]								    NEW(1)

NAME
new - report on folders with new messages fnext - set current folder to next folder with new messages fprev - set current folder to previous folder with new messages unseen - scan new messages in all folders with new messages SYNOPSIS
new [sequences] [-mode mode] [-folders foldersfile] [-version] [-help] fnext is equivalent to new -mode fnext fprev is equivalent to new -mode fprev unseen is equivalent to new -mode unseen DESCRIPTION
New in its default mode produces a one-line-per-folder listing of all folders containing messages in the listed sequences or in the sequences listed in the profile entry "Unseen-Sequence". Each line contains the folder, the number of messages in the desired sequences, and the message lists from the .mh_sequences file. For example: foo 11.* 40-50 bar 380. 760-772 824-828 total 391. The `*' on foo indicates that it is the current folder. The last line shows the total number of messages in the desired sequences. New crawls the folder hierarchy recursively to find all folders, and prints them in lexicographic order. Override this behavior by provid- ing foldersfile containing the pre-sorted list of folders new should check, one per line. In fnext and fprev modes, new instead changes to the next or previous matching folder, respectively. In unseen mode, new executes scan sequences for each matching folder. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
Path: To determine the user's nmh directory Current-Folder: To find the default current folder Unseen-Sequence: The name of the unseen message sequence SEE ALSO
scan(1), mh-format(5) HISTORY
Based on Luke Mewburn's new (http://www.mewburn.net/luke/src/new). MH.6.8 11 June 2012 NEW(1)
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy