Wie kann ich sicherstellen nur Dateien zu kopieren bei denen die letzten 3 Stellen des Dateinamens eine Zahl ist
Hallo zusammen
ich habe einen Order in dem mehrere Dateien sind.
ich mochte nur die Dateien mit xcopy in eine neues Verzeichnis kopieren, bei denen die letzten 3 Stellen des Dateinamens eine Zahl ist.
xcopy /y /q "C:\test\A1001.pdf" "C:\TEST\Uwe\" >nul 2>nul
Im voraus besten Dank
gruß Matthias
Edit
man manchmal siet man den Wald vor auter Bäumen nicht. Ich habe eine Lösung gefunden.
xcopy /y /q "C:\test\*0??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*1??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*2??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*3??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*4??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*5??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*6??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*7??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*8??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*9??.pdf" "C:\TEST\Uwe\" >nul 2>nul
es geht wahrscheinlich auch noch einfacher
aber es hat gefunkt
ich habe einen Order in dem mehrere Dateien sind.
ich mochte nur die Dateien mit xcopy in eine neues Verzeichnis kopieren, bei denen die letzten 3 Stellen des Dateinamens eine Zahl ist.
xcopy /y /q "C:\test\A1001.pdf" "C:\TEST\Uwe\" >nul 2>nul
Im voraus besten Dank
gruß Matthias
Edit
man manchmal siet man den Wald vor auter Bäumen nicht. Ich habe eine Lösung gefunden.
xcopy /y /q "C:\test\*0??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*1??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*2??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*3??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*4??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*5??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*6??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*7??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*8??.pdf" "C:\TEST\Uwe\" >nul 2>nul
xcopy /y /q "C:\test\*9??.pdf" "C:\TEST\Uwe\" >nul 2>nul
es geht wahrscheinlich auch noch einfacher
aber es hat gefunkt
Please also mark the comments that contributed to the solution of the article
Content-Key: 80397
Url: https://administrator.de/contentid/80397
Printed on: April 24, 2024 at 03:04 o'clock
1 Comment
Hallo Anfaenger99!
Etwa so:
Das "echo" steht wieder zum Testen drin ...
Grüße
bastla
[Edit] Da war ich dann etwas spät dran ... [/Edit]
Etwa so:
@echo off & setlocal
set "Basis=C:\Test"
set "Ext=*.pdf"
set "Ziel=C:\TEST\Uwe\"
for %%i in ("%Basis%\%Ext%") do call :ProcessFile "%%i"
goto :eof
:ProcessFile
set "N=%~n1"
set /a Test=1%N:~-3% 2>nul || goto :eof
echo xcopy /y /q %1 "%Ziel%" >nul 2>nul
goto :eof
Grüße
bastla
[Edit] Da war ich dann etwas spät dran ... [/Edit]