The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: microsoft.public.scripting.vbscript
From: "Pegasus [MVP]" <n...@microsoft.com>
Date: Fri, 6 Nov 2009 15:28:01 +0100
Local: Fri, Nov 6 2009 2:28 pm
Subject: Re: Move n files sort by Filename
news:b7cdd336-ef14-42bb-8cc5-979ecd986b49@k19g2000yqc.googlegroups.com...
>I have many files in a folder - I need to move only first 5 files You could use this simple batch file: > another folder sort by filename > ie in Source folder i have > 1Filename.txt > 2Filename.txt > 3Filename.txt > 4Filename.txt > 5Filename.txt > 6Filename.txt > 7Filename.txt > 8Filename.txt > 9Filename.txt > I need to move only FIRST 5 files sort by Filename to destination > Please give me a sample script for this @echo off SetLocal EnableDelayedExpansion set Source=d:\Source Folder set Target=d:\Target Folder set count=0 if not exist "%Source%" ( echo Cannot find the folder "%Source%" pause goto :eof ) if not exist "%Target%" md "%Target%" for /F "delims=" %%a in ('dir /on /b /a-d "%Source%"') do ( echo Moving "%Source%\%%a" rem move /y "%Source%\%%a" "%Target%" set /a count=!count! + 1 if !count! GEQ 5 goto :eof ) Remove "rem" in the fourth line from the bottom to activate the batch file. You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||