ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Select Range of Files Via Batch File

(1/1)

nkormanik:
Consider the following files within a folder:

01.txt
02.txt
03.txt
04.txt
05.txt
06.txt
07.txt
08.txt
09.txt

Via batch file how can one select a range of files, say to be moved?

Example:

Move 03.txt through 07.txt from folder A to folder B.

Such a simple thing.  And yet....

Thoughts and suggestions appreciated.

Thanks!

Nicholas Kormanik

4wd:
Regex: (0[3-7].txt) ... Now you just need to incorporate it into a PowerShell script.

Spoilerls R:\*|?{$_..... -match "0[3-7].txt$"}|%{mv $_......... D:\test}

Replace .... and ........ with the appropriate object properties.

Didn't think I'd make it that easy did you ;)

highend01:
findstr has a regex mode as well...

nkormanik:
@4wd, nicely done, indeed.  However, the example given is not so complicated, bear in mind.

Interesting that your suggestion, and of @highend01, is regex.  Pattern matching.  All 'intermediate' items must be matched.

Not exactly a through -- ordinal -- approach.

Using the usual Explorer route -- highlighting the first, shift-highlighting the last -- seemingly would be.  No command-line equivalent.

4wd:
However, the example given is not so complicated, bear in mind.-nkormanik (April 07, 2019, 03:11 PM)
--- End quote ---

You can't "select" via a batch/script unless the items to be selected always follow some pattern.  If they don't then they're always going to have to be selected by hand unless you want to code something overly complicated for the task.

The other alternative is to get it right, (file management), the first time so it's not necessary to use all these small batch/script files in the first place.

As @Shades said, get a decent file manager and stop screwing around with 101 dinky little one shot batch/script files.

Navigation

[0] Message Index

Go to full version