hi people,
i have a folder that has downloaded films in e\finished downloading when a film downloads it creates a folder within this folder. what i am trying to do is move .avi files that are bigger then say 400 mb in the e;\films folder. i only want to copy the .avi file and not the whole folder. once it has been copied i want the bat file to delete the folder the film came from. any ideas?
thank you
simple .bat copy that i can't do!!
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
UNTESTED:
Code: Select all
@echo off
cd /d "e:\finished downloading\somedir"
for %%a in (*.avi) do (
if %%~za GTR 400000000 move "%%a" e:\films
)
rd /s /q "e:\finished downloading\somedir"
-
- Posts: 3
- Joined: 04 Mar 2009 11:25
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Hmm . . . Should have thought of this -- are those .avi files larger than ~2 Gb? The if GTR command will choke around 2Gb.
Otherwise, the code seems to test OK. Should have added a cd command to get out of the dir that you're trying to delete:
If you're going larger than 2Gb, then we would do this:
Otherwise, the code seems to test OK. Should have added a cd command to get out of the dir that you're trying to delete:
Code: Select all
@echo off
cd /d "e:\finished downloading\somedir"
for %%a in (*.avi) do (
if %%~za GTR 400000000 move "%%a" e:\films
)
cd ..
rd /s /q "e:\finished downloading\somedir"
If you're going larger than 2Gb, then we would do this:
Code: Select all
@echo off
setlocal enabledelayedexpansion
cd /d "e:\finished downloading\somedir"
for %%a in (*.avi) do (
set fsize=%%~za
if defined fsize call set "fsize=%%fsize:~0,-8%%"
if 1!fsize! GEQ 14 move "%%a" e:\films
)
cd ..
rd /s /q "e:\finished downloading\somedir"