myGully.com

myGully.com (https://mygully.com/index.php)
-   Entwicklung & Programmierung (https://mygully.com/forumdisplay.php?f=72)
-   -   XCopy min. und max. Syntax Größe bei Jpg´s ? (https://mygully.com/showthread.php?t=2775579)

tommy221 11.12.12 23:39

XCopy min. und max. Syntax Größe bei Jpg´s ?
 
hallo,
habe total viel gesucht aber nichts gefunden.
ich will mit xcopy automatisch einfach nur alle bilder auf mein usb stick kopieren. in der batch steht:

@echo off
xcopy c:\*.jpg g:\bilderordner\/s
exit

aber wie lautet die syntax wenn jpgs erst ab mindestens 10 kb und z.b. maximal 1 mb
kopiert werden sollen?

(bitte keine xxcopy oder robocopy alternative)

danke euch :-)

Killer513 13.12.12 15:43

Ich wüsste nicht das soetwas mit Xcopy geht aba wenns dir weiterhilft hier ist das Manual

[Link nur für registrierte und freigeschaltete Mitglieder sichtbar. Jetzt registrieren...]

fryx 26.12.12 22:05

Dieser Code funktioniert mit folgenden Einschränkungen:
  • keinen relativen Pfad für Source angeben (".." funktioniert nicht)
  • Dateien mit Escape im Namen werden von XCOPY nicht als Ausnahme erkannt ("^") und immer kopiert
  • Dateien mit einer Grössenangabe > 32bit/2 (2.147.483.647 Bytes = 2,14 GiB) werden immer als Ausnahme eingetragen (nie kopiert), der Windows-Batchprozessor kann nicht damit rechnen
  • die Eingabe wird nicht auf Fehler überprüft (min > max usw)
Aufruf: min max (zB <s*****.cmd> 5000 6000)
Code:

@echo off &setlocal EnableDelayedExpansion

set "source=c:\*.jpg"
set "destination=g:\bilderordner"

set "exclusionfile=%random%%random%"
set "exclusionfile=%temp%\%exclusionfile:~-8%.txt"

goto :main

:setexclusion
set "tpath=%~pnx1"
echo !tpath!>>!exclusionfile!
goto :eof

:main
if "%1"=="" (goto :eof) else (set /a "min=%1") || goto :eof
if "%2"=="" (goto :eof) else (set /a "max=%2") || goto :eof

for /f "delims=" %%i in ('dir !source! /s /a-d /b') do (
        set "tfile=%%i"
        set /a "tsize=%%~zi" >nul 2>&1
        if errorlevel 1 call :setexclusion "!tfile!"
        if !tsize! LSS %min% call :setexclusion "!tfile!"
        if !tsize! GTR %max% call :setexclusion "!tfile!"
        )

xcopy !source! !destination! /s /exclude:!exclusionfile!
endlocal



Alle Zeitangaben in WEZ +1. Es ist jetzt 15:38 Uhr.

Powered by vBulletin® (Deutsch)
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.