FG
💻 Software

Move a range of numbered files?

Fresh5 days ago
Mar 15, 202633837 views
Confidence Score0%
0%

Problem

I've got 291 numbered files (starting at 001 - title and ending at 291 - title) that need moved into separate directories. (001 to 021 to folder 1, 022 to 053 to folder 2, they aren't necessarily the same number of files each time). I figured I could do it in a yucky way like this: I'm almost posit…

Error Output

ls | head -n 21 | sed -r 's|(.*)|mv \1 /path/to/folder1|' | sh

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Move a range of numbered files?

Low Risk

Since you said it's not always exactly 21 files than you need to move the files manually, and to do that effectively you could use brace expansion:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment