Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Move n files sort by Filename
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
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Pegasus [MVP]  
View profile  
 More options Nov 6 2009, 2:28 pm
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

"Bals" <balamurugan.mr....@gmail.com> wrote in message

news:b7cdd336-ef14-42bb-8cc5-979ecd986b49@k19g2000yqc.googlegroups.com...

>I have many files in a folder - I need to move only first 5 files
> 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
> folder
> 1Filename.txt
> 2Filename.txt
> 3Filename.txt
> 4Filename.txt
> 5Filename.txt

> Please give me a sample script for this

You could use this simple batch file:
@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.


    Forward  
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.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google