loquela Posted March 14, 2009 Share Posted March 14, 2009 Hi there, Does anyone know how the following script could be amended to work in dos? Cheers TOP_DIR=$1 count=1 for FILE in `find $TOP_DIR -type f -print` do mv $FILE $FILE.$count count=`expr $count + 1` done Quote Link to comment https://forums.phpfreaks.com/topic/149376-unix-shell-script-to-dos-translation/ Share on other sites More sharing options...
Mchl Posted March 14, 2009 Share Posted March 14, 2009 I do. It can't. You can however use PHP, Python or other scripting language. Quote Link to comment https://forums.phpfreaks.com/topic/149376-unix-shell-script-to-dos-translation/#findComment-784562 Share on other sites More sharing options...
loquela Posted June 20, 2009 Author Share Posted June 20, 2009 Yes, it can. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/149376-unix-shell-script-to-dos-translation/#findComment-860112 Share on other sites More sharing options...
RichardRotterdam Posted June 20, 2009 Share Posted June 20, 2009 Use batch or any of the other options previously mentioned. That or use some kind of emulator Quote Link to comment https://forums.phpfreaks.com/topic/149376-unix-shell-script-to-dos-translation/#findComment-860118 Share on other sites More sharing options...
captbeagle Posted July 26, 2009 Share Posted July 26, 2009 I don't know Unix shell scripting at all, but I'm taking a rough guess and hoping that that's supposed to count the number of files in the root directory. If not, let me know and I'll revise my batch file for you. If I'm right in my assumption, here's your Windows batch file equivalent: dir /a "C:\" |find /c /v "" Now, that will only count the number of files in the root directory. It won't look inside any subdirectories. Add the /s switch after the /a to search inside subdirectories. If you were trying to make a batch file that asks the user were to search, you could use something like: ::File count ::captbeagle CLS @ECHO OFF title Counting your files... one by one! SET /P directory=Directory to search: SET /P sub=Search subdirectories [Y/N]: IF "sub"=="Y" GOTO subs GOTO no_subs :subs dir /a /s %directory% |find /c /v "" pause exit :no_subs dir /a %directory% |find /c /v "" pause exit Quote Link to comment https://forums.phpfreaks.com/topic/149376-unix-shell-script-to-dos-translation/#findComment-883022 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.