I'm having one great challenge according to create a batch file. Here is my situation I'm having folder full of folders and files(note all the files are in ".apf" extension). I want to create a empty file with ".event" extension in each and every folder where the folder name and if one of the file name is same. The created ".event" extension file should be same as the folder name and file name where as same. Thanks in advance pls help me.
Example: "apple"->folder name
"orange.abf","pineapple.abf","apple.abf" -> file names inside apple folder
I've to check the folder name and file name where they are same. If same name found then I have create a empty file in the same name with ".event" as a extension.
As I found apple as a same name in folder name and also file name I have to create a empty file as "apple.event"
I wants to create a batch file with the following conditions
Moderator: DosItHelp
-
- Posts: 7
- Joined: 25 Apr 2013 09:55
I wants to create a batch file with the following conditions
Last edited by akbarsha03 on 25 Apr 2013 10:09, edited 1 time in total.
Re: I wants to create a batch file with the following condit
One of the file name is same of what?
-
- Posts: 7
- Joined: 25 Apr 2013 09:55
Re: I wants to create a batch file with the following condit
I have briefly explained the condition please check. Thanks in advance
Re: I wants to create a batch file with the following condit
Try this and remove the "echo" command before "copy" if the output is OK:
Code: Select all
@echo off&setlocal
set "startfolder=X:\my start\folder"
for /d /r "%startfolder%" %%i in (*) do if exist "%%~fi\%%~ni.apf" echo copy nul "%%~fi\%%~ni.event"
-
- Posts: 7
- Joined: 25 Apr 2013 09:55
Re: I wants to create a batch file with the following condit
Endoro wrote:Try this and remove the "echo" command before "copy" if the output is OK:Code: Select all
@echo off&setlocal
set "startfolder=X:\my start\folder"
for /d /r "%startfolder%" %%i in (*) do if exist "%%~fi\%%~ni.apf" echo copy nul "%%~fi\%%~ni.event"
Thanks for the quick response and help.... Very much appreciated.. code worked once i removed the echo before copy!! thanks very much. May I know if i will give the location of the folder in shared path of the server, then it will work? If not what is the alternative?


Re: I wants to create a batch file with the following condit
It should also work with a shared net ressource.
-
- Posts: 7
- Joined: 25 Apr 2013 09:55
Re: I wants to create a batch file with the following condit
Endoro wrote:It should also work with a shared net ressource.
thanks for the guide


thanks in advance