Use a variable for a destination path???


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Use a variable for a destination path???

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Use a variable for a destination path???

    [Originally posted by [-_-]]

    GoodDay!!!

    Can you do this one for Me,

    Everytime the program starts, I want to copy an˙ existing textfile to a new file with a filename of Time and Date. I store the Date and Time to a variable but I always get an error.

    code like this:
    newPath = app.path & "\" & Date$ & Time$ & ".txt"
    FileCopy app.path & "\blankfile.txt", newPath
    ---------------------------

    I'm making history file (log file) everytime the program started.˙ 

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Use a variable for a destination path???

    [Originally posted by Ed Ardzinski]

    Could be a problem witht he colon character the Time$ function puts out.˙ I couldn't save a file named "9:24:55.txt"...the file name is not valid.

    Instead of "Time$" try Format(Now,"hhmm")...this shuld give a file name that doesn't give an error.

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Use a variable for a destination path???

    [Originally posted by Jim]

    Depending on how the date is formatted, it may be looking for a folder path that looks something like this
    c:\mybasefolder\11\7\
    so that it is trying to save the file
    c:\mybasefolder\11\7\2001 17:40:21.txt

    most likely the folders 11 and 7 do not exist.˙ Apply the same formatting Ed suggested on the date also and you should be ok.

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Use a variable for a destination path???

    [Originally posted by mann]


    i'll try what u says...

    Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center