0

I am trying to create some files using fsutil, but no files are getting created with the following loop, neither is an error getting generated, any suggestions?

foreach (string extension in extensions) { Process.Start("fsutil", @"file createnew e:\attachments\" + DateTime.Now.ToString() + extension); } 
2
  • 1
    Your application has administrative privileges, I take it? Commented Sep 25, 2009 at 8:51
  • Sure, running as my logged on admin account. Commented Sep 25, 2009 at 8:57

1 Answer 1

4

DateTime.Now.ToString() might be returning spaces and characters that aren't allowed in filenames. Try quoting the filename for the argument string and replacing any colons with underscores, or the like. FSUTIL also requires the length of the file to be specified, as ArsenMkrt stated.

Usage : fsutil file createnew <filename> <length> Eg : fsutil file createnew C:\testfile.txt 1000 
Sign up to request clarification or add additional context in comments.

1 Comment

Basically, just make sure your resulting filename is allowed by the operating system by removing/replacing characters that aren't allowed, and you'll be fine and dandy. =)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.