Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • This doesn't work, which just create the same result of having each folder for each file. but we would like to create one folder for each similar copy files. one folder for 001.txt and 001(1).txt where 001.txt and 001(1). txt have different content. Commented Aug 4, 2022 at 12:29
  • @johnsmith please update your question to make that clear. You have currently written "For each two similar copy, create one folders and move both similar file into the folder.", and that is what this code does. Commented Aug 4, 2022 at 12:33
  • @johnsmith I see your edit. My code does exactly what you ask for the example filenames you provide (item.txt and item(1).txt, etc.). Therefore, if it's not working for you, you need to give examples of the file names that work and those that do not. Commented Aug 4, 2022 at 13:45
  • Ok You bash script works great. when it was run as bash instead of copying the lines one by one. Thank you. Any ideal ? yes I was also doing the "set -o errexit -o nounset" command, not sure if there is the problem. Commented Aug 4, 2022 at 14:03