Hi every one,

I have a question.

I have many files with this format:

a...a-Cb...b-d...d
a...a-b...b-Cd...d
a...a-b...b-Cd...d-e...e

so that :

1- a...a is a number with m digits,
2- b...b is a number with n digits,
3- d...d is a number with p digits,
4- e...e is a number with q digits.

and have many folder with respect to these files with this format:

"Cb...b-d...d #"
"Cd...d #"
"Cd...d-e...e #"

so that instead of # character, i have words with unicode character like this:

"C234-1 عربی"

I want a batch file, so that move by this method:

1- move files with format a...a-Cb...b-d...d to folder "Cb...b-d...d #"
2- move files with format a...a-b...b-Cd...d to folder "Cd...d #"
3- move files with format a...a-b...b-Cd...d-e...e to folder "Cd...d-e...e #"

thanks for your helps.

Use the 'find' command with the -exec option where you will move the qualifying files to a specific folder. Example:

find /dirname -type f -name '<pattern>' -exec mv {} /targetdir \;

This will move all files under /dirname to /targetdir. It will skip directories (using the -type f argument) and only apply the command to files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.