How can I rename a file whose name is in itself a full path (e.g. begins with "g:\")? [duplicate]

Solution 1:

This couldn't be the fastest solution, but it should work.
If you boot a Live Linux distro you can delete it, since Linux uses a different method to identify partitions and won't be forced to think that your file is a drive. I suggest you Parted Magic, that has many handy tools for disk and system maintenance and, beside your current concern, is always useful to have it at hand.

Solution 2:

If your OS Windows then you can use the following trick:

1. Issue command `dir /X`
2. Find out your file in 8 dot 3 notation
3. Use 8 dot 3 notation for file operations as ren, del, copy, print and others.

Note, if you managed to create file with name con or some other Windows device reserved names then you are out of luck with the approach.

Solution 3:

You could also try...

From a Windows Command Prompt:

ren "F:???filename.csv" "filename.csv"

or

ren "F:*.csv" "filename.csv"