Setting a output path from a file path?


#1

What would be the best way to turn a file path into a folder path? So like C:\Users\ErraticFox\Videos\test.mp4 could be C:\Users\ErraticFox\Videos\ ? I can’t think of a way because this path will be various and sometimes contain dots and all. Unless there’s a way to set a output path. If I’d be able to set a output path, this would tremendously help out a lot.


#2

You can run any path through fs.realpath() to get the canonical path and then chop off the file name.