User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » batch script help Page [1]  
wwwebsurfer
All American
10217 Posts
user info
edit post

Quote :
"SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

pushd "\\render-2\finished videos"
echo y | copy NUL /temp_blank.txt>NUL
echo Running tribute ninja for %date%>/output.txt
dir /b /A>/temp_folders.txt

for /F "tokens=*" %%a IN ("/temp_folders.txt") do (
echo -------------------------------------------------->>/output.txt
echo %%a>>/output.txt
cd "/%%a"
findstr /r /s "\<[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\>" "*.txt">/temp_tributeid.txt
for %%b IN (/temp_tributeid.txt) do (
if %%~zb==0 (
echo ...no tribute ID detected>>/output.txt
) else (
for /F "tokens=*" %%c IN (/temp_tributeid.txt) do (
set line=%%c
set id=!line:~-8!
::copy /V *.wmv /tributes/%id%.wmv
echo ...!id! copied for upload>>/output.txt
)
)
)
echo we are ready for upload...>>/output.txt
popd"


This is supposed to find files on a network drive, read their text files for a variable, then copy them to another location (ftp - removed). I thought I had it working; but now it's crashing on line 9 (first FOR loop.) Any ideas?

10/11/2011 1:47:13 PM

Stein
All American
19842 Posts
user info
edit post

Stop hating your life and use Powershell?

10/11/2011 2:00:33 PM

dakota_man
All American
26584 Posts
user info
edit post

I don't think the command interpreter supports smiley faces yet.

10/11/2011 2:12:02 PM

wwwebsurfer
All American
10217 Posts
user info
edit post

^^the original version of this script was in bash... unfortunately it now needs to run from a windows xp machine....

that's : and D - it prints a list of directories to a file. Unfortunately DOS doesn't have very advanced controls for working with reading from files so I have to write like 5 different ones

10/11/2011 2:19:04 PM

Stein
All American
19842 Posts
user info
edit post

You can install Powershell 2.0 on XP SP3!

10/11/2011 2:26:12 PM

Stimwalt
All American
15292 Posts
user info
edit post

You'll spend less time re-creating it in Powershell, rather than debugging that.

10/11/2011 2:57:36 PM

dakota_man
All American
26584 Posts
user info
edit post

when I pushd a network share with the command line, it seems to automatically map it to an unused drive letter (Z: so far). Maybe after pushd stop using / like it's a network path.

10/11/2011 3:01:11 PM

wwwebsurfer
All American
10217 Posts
user info
edit post

got it fixed!

I have no idea what the problem was. I copied the text into a new file, saved, and it worked.

Editor must have been using an encoding winXP didn't like or something.

10/11/2011 5:00:51 PM

 Message Boards » Tech Talk » batch script help Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.