How to rename a file in .NET?

Alternatives System.IO.File.Move You can rename a file with System.IO.File.Move like this: var sourcePath = @”C:\folder\oldname.txt”; var destinationPath = @”C:\folder\newname.txt”; File.Move(sourcePath, destinationPath); You may be interested in keeping the same location and just change the name of the file. Sure that can be done: var sourcePath = @”C:\folder\oldname.txt”; var newName = “newname.txt”; var directory = Path.GetDirectoryName(sourcePath); … Read more

Renaming a directory in C# [closed]

There is no difference between moving and renaming; you should simply call Directory.Move. In general, if you’re only doing a single operation, you should use the static methods in the File and Directory classes instead of creating FileInfo and DirectoryInfo objects. For more advice when working with files and directories, see here.

How do you change the capitalization of filenames in Git?

Starting Git 2.0.1 (June 25th, 2014), a git mv will just work on a case-insensitive OS. See commit baa37bf by David Turner (dturner-tw). mv: allow renaming to fix case on case-insensitive filesystems “git mv hello.txt Hello.txt” on a case-insensitive filesystem always triggers “destination already exists” error, because these two names refer to the same path … Read more

git rename many files and folders

This should do the trick: for file in $(git ls-files | grep %filenamematch% | sed -e ‘s/\(%filenamematch%[^/]*\).*/\1/’ | uniq); do git mv $file $(echo $file | sed -e ‘s/%filenamematch%/%replacement%/’); done To follow what this is doing, you’ll need to understand piping with “|” and command substitution with “$(…)”. These powerful shell constructs allow us to … Read more

Handling renames: svn vs. git vs. mercurial

Git doesn’t track renames at all, but uses heuristic to re-discover them during merge etc. Mercurial tracks renames (the origin version and origin file is recorded) and uses that information during merges. So you have to explicitly tell hg about renames with hg mv, or use hg addremove –similarity for auto-discovery. There has been some … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)