1.

Solve : create null file's?

Answer»

hi

I have a quasion if possible help me. thanks
i need a batch file so

1: i have a file in folder  F:\modern and the file name is  modern.iwi (base file)
2: and so another file with name.txt in F:\Name folder (this txt file inclod 500 name's each name per line )

so i want a batch for this:

create a 500 file's (as the name.txt file have 500 name's) by using the modern.iwi and Name.txt files...
my means copy the modern.iwi with a new name is in the name.txt file in F:\new folder

thanks very much...
Put this batch file in the same folder as your Name.txt file and run it.
CODE: [Select]for /f "tokens=*" %%A in (name.txt) do copy "f:\modern\modern.iwi" "F:\New Folder\%%~A"its nice man very thank you 

so is it possible Instead of name.txt use the name of file's from F:\Ramin folder (with out name.txt)!? Quote from: raminr63 on December 14, 2011, 02:57:55 PM

its nice man very thank you 

so is it possible Instead of name.txt use the name of file's from F:\Ramin folder (with out name.txt)!?

so instead of (name.txt), try this ('dir /b f:\ramin'), let me know if that works Quote from: skorpio07 on December 14, 2011, 03:49:19 PM

so instead of (name.txt), try this ('dir /b f:\ramin'), let me know if that works
When I do use the dir command I always try and do a pushd to set the working directory FIRST and I usually make sure I exclude listing directories.

But it would probably be better to ue the for /d option.i am noob 

can you give me a complate cod for (( so instead of (name.txt), try this ('dir /b f:\ramin'), let me know if that works ))such as

Quote
for /f "tokens=*" %%A in (name.txt) do copy "f:\modern\modern.iwi" "F:\New Folder\%%~A"

so thanks

and
/ Squashman thank's for help Code: [Select]for /f "tokens=*" %%A in ('dir /b f:\ramin') do copy "f:\modern\modern.iwi" "F:\New Folder\%%~nA"
Squashman's pushd reference is good, though unnecessary in this instance I believe (though not a bad habit to start if you are planning on getting into programming.) I don't understand the point behind using the /d switch over the /f switch though. Please explain./Raven19528
Thanks its working good
I know it's more but i have just 1 question again

when the source [ ('dir /b f:\ramin') ] have sub-folders i must create sub-folders manually in [ "F:\New Folder\%%~nA" ] with out it, its not worked so is it possible the sub-folders create automatically (forced) with out me ?!! 

and it just only copy the file names from [ ('dir /b f:\ramin') ] and the file format from [ f:\modern\modern.iwi ] not copied ?!! so the copied files have no formats ?! Quote from: Raven19528 on December 14, 2011, 05:25:44 PM
I don't understand the point behind using the /d switch over the /f switch though. Please explain.

It's not "instead" of the /f switch.

FOR can use wildcards like this FOR %%A in (*) which will find files, FOR /D %%A in (*) will find directories. SEE the FOR help.
Quote from: raminr63 on December 14, 2011, 09:34:46 PM
I know it's more but i have just 1 question again

when the source [ ('dir /b f:\ramin') ] have sub-folders i must create sub-folders manually in [ "F:\New Folder\%%~nA" ] with out it, its not worked so is it possible the sub-folders create automatically (forced) with out me ?!! 

and it just only copy the file names from [ ('dir /b f:\ramin') ] and the file format from [ f:\modern\modern.iwi ] not copied ?!! so the copied files have no formats ?!

?! and waitting lol Quote from: raminr63 on December 15, 2011, 02:09:09 AM
?! and waitting lol

Goodbye... un-notifying...
Quote from: Salmon Trout on December 15, 2011, 12:27:50 AM
FOR can use wildcards like this FOR %%A in (*) which will find files, FOR /D %%A in (*) will find directories. See the FOR help.

So if I get this right, I could use 'FOR /F /D %%A in (*)' and find both files and directories in a particular location? Would this find the files and folders within the SUBDIRECTORIES? I would think not because that would be what the /R switch is for, but I'm not certain.

Quote from: raminr63 on December 15, 2011, 02:09:09 AM
?! and waitting lol

Comments like this (as shown) are not appreciated. Understand that we do not work on this forum, but that we volunteer our time and knowledge as we can. This is a really fast way to make sure that your posts are ignored by those who can provide you help. And the  at the end does not make up for the blatent impatientness of the post.

It's my belief that this is a situation where Squashman's suggestion of using pushd will be needed to help get everything done the right way. I haven't taken the time to try to test anything on this, but perhaps if you can show some patience, the SPIRIT of the holiday season will be enough that you do receive some help on the topic.

Again, we work here for free. Please keep that in mind when requesting help. Quote from: Raven19528 on December 16, 2011, 11:25:57 AM
So if I get this right, I could use 'FOR /F /D %%A in (*)' and find both files and directories in a particular location? Would this find the files and folders within the subdirectories? I would think not because that would be what the /R switch is for, but I'm not certain.

The FOR help, accessed by typing FOR /? at the prompt describes the syntax very clearly.



Discussion

No Comment Found