LastWriteTime and Locating the drive letter of a flash drive.


  1.    11 Jul 2007 #1
    Fred J. Guest

    LastWriteTime and Locating the drive letter of a flash drive.


    Part 1
    Is the Get-ChildItem property 'lastwritetime' equivalent to explorer's
    'Date Modified'?
    Part 2
    I am running Windows XP. I back up my files to a flash drive. My
    current 'cmd' script blindly erases the files from my flash drive and
    then 'copies' my working set from my hard drive to the flash drive.

    I am writing a PS script that compares the 'lastwritetime' date
    between the two media. Interesting enough I have stumbled upon this;
    The lastwritetime as it appears on the flash drive is usually 1 to 2
    seconds later than the lastwritetime on the hard drive. As I
    understand it, these are not the physical times that the files were
    copied, but rather when they were modified. So I am wondering why
    this inconsistency occurs?

    To accommodate this I do something like;

    if ($timediff.totalseconds -le 60)
    {write-Host "dont copy file $hdFilePath"
    $CurrentFileCount++
    }
    else {
    write-Host "copy required for $hdFilePath"
    copy-Item $hdFilePath -destination $fdDir
    if ($?) {
    write-Host "Copy ok for $hdfilepath to $fdDir"
    $UpdateCount++
    }else {
    read-Host -prompt "FAILURE on Copy of $hdfilepath to
    $fdDir"}
    }

    Part 3
    Depending on the current state of chaos, my flash-drive's drive letter
    may change. So I try to dope out the drive letter of the flash drive
    by doing something like;
    get-psdrive | foreach-object {if($_.description -like "lexar")
    {$flashdrive= $_.name}}

    Are there other alternatives and what property suggests that the flash
    drive is 'Removable Storage' as described in 'My Computer?

    Thank you,
    Fred J.

      My System SpecsSystem Spec

  2.    11 Jul 2007 #2
    Kiron Guest

    Re: LastWriteTime and Locating the drive letter of a flash drive.


    Part 1
    LastWriteTime is equivalent to Date Modified

    Part 2
    Maybe this KB support article helps
    http://support.microsoft.com/kb/299648

    Part 3
    To get the type of drive use System.IO.DriveInfo.GetDrives Method:

    [io.driveinfo]::getDrives() | format-table Name, DriveType -auto

    To get all removable drives:

    [io.driveinfo]::getDrives() | where-object {$_.DriveType -eq 'Removable'} |
    select-object Name

    http://msdn2.microsoft.com/library/S...GetDrives.aspx
    http://msdn2.microsoft.com/en-us/lib...drivetype.aspx
    http://msdn2.microsoft.com/en-us/lib...drivetype.aspx

    --
    Kiron

      My System SpecsSystem Spec

  3.    11 Jul 2007 #3
    gelyon@gmail.com Guest

    Re: LastWriteTime and Locating the drive letter of a flash drive.


    Part 2:
    FAT32 timestamp resolution = 2 seconds.
    NTFS timestamp resolution = 100 nanoseconds.


      My System SpecsSystem Spec

  4.    12 Jul 2007 #4
    Fred J. Guest

    Re: LastWriteTime and Locating the drive letter of a flash drive.


    On Jul 11, 3:41 pm, "Kiron" <K...@HighPlainsDrifter.com> wrote:
    > Part 1
    > LastWriteTime is equivalent to Date Modified
    >
    > Part 2
    > Maybe this KB support article helpshttp://support.microsoft.com/kb/299648
    >
    > Part 3
    > To get the type of drive use System.IO.DriveInfo.GetDrives Method:
    >
    > [io.driveinfo]::getDrives() | format-table Name, DriveType -auto
    >
    > To get all removable drives:
    >
    > [io.driveinfo]::getDrives() | where-object {$_.DriveType -eq 'Removable'} |
    > select-object Name
    >
    > http://msdn2.microsoft.com/library/S...drivetype.aspx
    >
    > --
    > Kiron


    Thank you,
    Fred Jacobowitz

      My System SpecsSystem Spec

  5.    12 Jul 2007 #5
    Fred J. Guest

    Re: LastWriteTime and Locating the drive letter of a flash drive.


    On Jul 11, 6:47 pm, gel...@gmail.com wrote:
    > Part 2:
    > FAT32 timestamp resolution = 2 seconds.
    > NTFS timestamp resolution = 100 nanoseconds.


    Thank you. I don't understand why the time resolution on a copy file
    should be skewed (I can understand lastwritetime when a file is
    modified) but it does appear to be.
    Fred J

      My System SpecsSystem Spec

LastWriteTime and Locating the drive letter of a flash drive.

Similar Threads
Thread Forum
Removing External drive with Ubuntu OS but no drive letter designation
I have a wierd problem that most of the suggestions seem not to work. I have a HP computer with Vista basic installed at factory with no disc sent...
General Discussion
Re: How to manage disk drive letter when conflicting with network drive ?
Most of them are using SP3. Are you sure that the problem adressed in SP3 is the same as the situation quoted here ? Thank you ! -- Eric
Server General
Flash Drive has no drive letter... Not in Disk Management
Hi guys, Im hoping someone will be able to help me here... I recently fresh installed my Vista Premium x86 on my homebuilt, and I had all my...
Vista hardware & devices
Phantom CD Drive after reassigning Recovery Partition drive letter
Another annoying Vista mystery. I just got a new HP Vista desktop -- I already have an HP Vista laptop. On both, HP provided a Recovery-Image...
Vista installation & setup
How could I get a USB Flash disk's drive letter?
In XP, I used these functions to get a usb device volume to compare, but it cannot work in Vista SetupDiGetClassDev ==> get...
Vista hardware & devices
USB drive letters and mapped drive letter issues
In Windows XP, I always had problems with clients who wanted to use USB drives in a corporate environment where drives are mapped via scripts to low...
Vista hardware & devices
USB drive letters and mapped drive letter issues
In Windows XP, I always had problems with clients who wanted to use USB drives in a corporate environment where drives are mapped via scripts to low...
Vista hardware & devices

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • Old server
    About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 17:44.
    .