Code: Select all
copy "\\Root\SharedFolder\File.xlsx" \\server\site\Folder\
Also, there are several files in the folder that are not named the same. Example: file1_20141117, file2_20141117, etc. I need to find the most recent (file1) for example.
Moderator: DosItHelp
Code: Select all
copy "\\Root\SharedFolder\File.xlsx" \\server\site\Folder\
Code: Select all
@echo off
PUSHD "\\Root\SharedFolder"
FOR /F "delims=" %%G in ('dir /B /OD File1*.xlsx') do "set newfile=%%~G"
copy "%newfile%" "\\server\site\Folder\"
POPD
doctork11 wrote:C:\Users\*>C:\Users\*\Desktop\test.bat
Code: Select all
@echo off
PUSHD "\\Computer\RPTest"
FOR /F "delims=|" %%I IN ('DIR "filename_*.xlsx" /B /O:D') DO SET newfile=%%I
copy "%newfile%" "\\Computer\RPView\"
POPD
doctork11 wrote:Asterisks were from me. I took out my name and replaced it. Sorry.
I made some changes and it works exactly how I want it to. Do you see any problem with the code?
P.S. I would have never gotten there without your help. Thank youCode: Select all
@echo off
PUSHD "\\Computer\RPTest"
FOR /F "delims=|" %%I IN ('DIR "filename_*.xlsx" /B /O:D') DO SET newfile=%%I
copy "%newfile%" "\\Computer\RPView\"
POPD
Code: Select all
@PushD \\Computer\RPTest
@For /F "Delims=" %%A In ('Dir/B/OD "filename_*.xlsx"') Do @Set newfile="%%A"
@Copy %newfile% \\Computer\RPView