I tried the method here, but it failed.

I have test files and folders in ~/Desktop/z named n copy, n copy 2, and untitled folder.

I cd'd to z, ran the command, then this was the output:

the output

How can this be done?


The script is fine and works perfectly when I tested it. The output is telling you that the folder that you’re trying to create already exists (probably from a first round of testing and then neglecting to delete the folder before running another test).

However, the files still get moved into the correct folders. So either make sure the folders don’t already exist, or just ignore the message.

Don’t forget, your script is designed to move files, not folders. So untitled folder (presuming it’s a folder) will be ignored. n copy and n copy 2 (if these are files, not folders) get moved into folders of the same name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.