Open
Description
Hello, I came across your repo that promising me. This is the only one of its kind. But I can not understand how to customize the script for my need. I am still at the beginning of my studies in computer programming but I thought I was comfortable enough in Swift.
I would like to rename about 5000 files that have this scheme there:
"Randomtext randomtext randomtext 848484984984.txt" To rename them in "848484984984.txt".
So I thought I could apply this treatment here:
public func componentsSeparatedByStrings() -> String {
let separators = ["%20"]
let arrayName = separators.reduce([self]) { result, separator in
return result.flatMap { $0.components(separatedBy: separator) }
}.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) } // ["RandomText, RandomText, RandomText, 848484984984"]
let newName = arrayName.last
return newName! //848484984984
}
Unfortunately I can only have this result in my terminal.
'RandomText Randomtext Randomtext 848484984984.txt ' not Renamed
Would you have the kindness to help me? I thank you in advance
Metadata
Metadata
Assignees
Labels
No labels