Just Code‎ > ‎

Tagga fil med prefix

posted Aug 26, 2009, 9:34 AM by Peter Henell
   public static void Tag(string filePathAndName, string tag)
        {
            if(File.Exists(filePathAndName))
            {
                string oldFileName = Path.GetFileName(filePathAndName);
                string oldFilePath = Path.GetDirectoryName(filePathAndName);
                string newFileName = string.Format(@"{0}{1}{2}", oldFilePath, tag, oldFileName);
               
                File.Move(filePathAndName, newFileName);
                Console.WriteLine(newFileName);
            }
        }
Comments