FG

UNIX shell scripting: how to recursively move files up one directory?

Fresh3 days ago
Mar 15, 202613002 views
Confidence Score0%
0%

Problem

I have a large number of small files, f, arranged in a directory structure like so: There are 11 directories at the level of A, each with about 100 directories at the level of B, each with about 30 directories at the level of C, each with one file f. How do I move all files f up one level? For exam…

Error Output

/A/B/C/f

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: UNIX shell scripting: how to recursively move files up one directory?

Low Risk

It's fairly simple with GNU find (as found on Linux) or any other find that supports : With a standard : With zsh: If the directory structure always has the same nesting level, you don't need any recursive traversal (but remove empty directories fir…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment