The following link is one of many resources that describe its use: It looks as if the general case presented by the test folder you uploaded may possibly be solved fairly easily using a For /R loop, which I've never had occasion to use myself, possibly simply with minor editing of my code above. Windows Batch File Looping Through Directories to Process Files? In Windows, a batch file with a recursive for loop and a file name including blanks I'm posting the following links to potentially useful forums which displayed results that may have some relevance to your need: don't ask me to provide support on the answers as in general I can't! With a little time to spare I've just done some research which may be useful to you if you wish to continue the command line approach, either now or if you feel motivated to continue later.įirst I made a quick Google search using 'batch file to process files recursively' to illustrate how general coding forums can help, and identify a couple I recognise from previous searches. It would be worth your taking a look at the posts in the NConvert section of the forum, particularly 'How to use NConvert', although it necessarily can't explain everything. Note that I've written this in a hurry as I have to go out, if you hit a problem you can't overcome don't be too put out! O Then double-click the batch file and if it runs check if the JPEG files have been created as expected if the script doesn't run it may be a Windows configuration issue. Then place the file in the folder with the other files. bat extension, you can enter the extension in Notepad in place of a text extension. O Copy my code above into a text file and save the file with a name such as script and a. O Place in the folder a copy of my folder Files copied from the above ZIP. O Place in the folder a copy of nconvert.exe copied from the download. O Create a new folder somewhere, the location shouldn't matter. To give a quick answer to your question, I would suggest in the first instance you reproduce my test setup exactly, although in some respects it may be an unusual way of working. If you have little or no previous command line experience I can tell from my own experience that it can be a steep learning curve, and unforgiving when a problem arises as very often happens: as a long-term Windows user with minimal DOS experience, I never expected to use the command line until I discovered NConvert and realised that it could be useful for a project I had at the time. where do I place it and where do I place the folder filled with folders which have in their first level, before double clicking on the. "%%Y\*.png" by to limit conversion to the files you specified. My code above will convert all PNG files in each first level folder to JPEG, if there could be other PNGs in a folder replace I'm not familiar with command line options for XnConvert, to the extent that they currently exist: if you wish to use XnConvert you could start a new thread under that forum heading. Regarding XnConvert, it should be possible to configure it to process a folder containing multiple first level folders you could test whether it will also handle more complex folder structures. You may need to edit the code to use full paths (enclosed in double quotes if there are any spaces in the paths), rather than the relative addressing I used, depending on how you test. bat should process the PNG files in any number of first level folders, while ignoring any other files in the folders such as the text files in the test folder example you uploaded. The code I posted above when run in a batch file. If you have some command line experience, you could download NConvert and create a copy of the help file, if you might be interested in an NConvert solution. That is the syntax specified in the NConvert help file when the -out option, for example, is used. Just wondering why jpeg and not jpg in your code?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |