Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to move files into different folders based on filename Post 302086208 by tayyabq8 on Wednesday 23rd of August 2006 01:01:26 AM
Old 08-23-2006
One other way:
Code:
# /bin/ksh

for i in `ls -l | grep -v "^d" | awk '{print $9}'`; do
dir=${i%.*}
mv "$i" "$dir"/"$i"
done

 

9 More Discussions You Might Find Interesting

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

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

3. UNIX for Dummies Questions & Answers

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (2 Replies)
Discussion started by: Sriranga
2 Replies

4. Shell Programming and Scripting

want to move files in a dir into different directories based on the filename

I want to move the files in a dir to different dirs based on their file names. Ex: i have 4 different files with name - CTS_NONE_10476031_MRL_PFT20081215a.txt CTS_NONE_10633009_MRL_PFT20091020a.txt CTS_NONE_10345673_MRL_PFT20081215a.txt CTS_NONE_10872456_MRL_PFT20091020a.txt and the 1st... (4 Replies)
Discussion started by: Sriranga
4 Replies

5. Shell Programming and Scripting

Move file based on filename

Hi All I need a script to manipulate files based on a filename: example filename: 66600_042706.pdf the script will create a directory 66000 only if this directory is not existing. If that directory is existing it will just move the file to 66000/666000_042706.pdf in addition, i want to... (4 Replies)
Discussion started by: aemestech
4 Replies

6. Shell Programming and Scripting

Move files based on date in filename

I know this gets covered quite a bit in the forum and I think there is enough there for me to figure out how to do what I am trying to do, I just don't think I would do it very efficiently so I am going to ask the question... I have database log files with date and time stamps in the file like ... (7 Replies)
Discussion started by: slatoms
7 Replies

7. Shell Programming and Scripting

Move all files from source to destination directory based on the filename

Move all files starting with a specific name to different directory. This shell script program should have three parameters File Name Source Directory Destination Directory User should be able to enter ‘AB_CD*' in file name parameter. In this case all the files starting with AB_CD will... (1 Reply)
Discussion started by: chetancrsp18
1 Replies

8. Solaris

Move files into different folders based on its month

Hi All, I want to move the files in to different folders based on the files month in the file timestamp. For example All the september files in the directory should moves into the folder "sep_bkp_files" , August files in to aug_bkp_files folder... Please help me to achive the above... (10 Replies)
Discussion started by: velava
10 Replies

9. 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
XmDirectionToStringDirection(library call)								XmDirectionToStringDirection(library call)

NAME
XmDirectionToStringDirection -- A function that converts an XmDirection value to an XmStringDirection value SYNOPSIS
#include <Xm/Xm.h> XmStringDirection XmDirectionToStringDirection (dir) XmDirection dir; (void) DESCRIPTION
XmDirectionToStringDirection converts the specified XmDirection direction value to its equivalent XmStringDirection value. Basically, if the XmDirection value has a horizontal direction specification, that horizontal element is used; otherwise, the XmStringDirection value is interpreted as XmSTRING_DIRECTION_L_TO_R. This function provides backward compatibility with the XmStringDirection data type. Note that the Motif toolkit also contains an XmStringDirectionToDirection routine to convert an XmStringDirection value to its XmDirection equivalent. dir Specifies the XmDirection value to be converted. RETURN
Returns the following XmStringDirection values: XmSTRING_DIRECTION_R_TO_L If the dir argument has a right to left horizontal direction value in it, for example XmRIGHT_TO_LEFT_TOP_TO_BOTTOM. XmSTRING_DIRECTION_L_TO_R If the dir argument has a left to right horizontal direction in it, for example XmLEFT_TO_RIGHT_TOP_TO_BOTTOM, or if the horizon- tal direction value in the dir argument is ambiguous, such as in the XmTOP_TO_BOTTOM value. XmSTRING_DIRECTION_DEFAULT If there was no horizontal direction specified. RELATED INFORMATION
XmDirection(3), XmDirectionMatch(3), XmDirectionMatchPartial(3), XmDirectionToStringDirection(3), XmString(3), XmStringDirection(3), and XmStringDirectionToDirection(3), XmDirectionToStringDirection(library call)
All times are GMT -4. The time now is 09:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy