Thread: Powershell Script to remove GZip .dat files and remove .dat from name

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Powershell Script to remove GZip .dat files and remove .dat from name 
    Registered Member
    Flub's Avatar
    Join Date
    Apr 2017
    Posts
    167
    Thanks given
    11
    Thanks received
    32
    Rep Power
    103
    Hi Guys,

    I recently explored adding Models etc into my Client via the repackindex(1) method from Galkon,

    However I was stressed when I couldn't seem to find an easy way to individually GZip the .dat files without it containing .dat in the file name..

    Save this code into a powershell file and save it in the folder with your .dat files

    Simply Right Click 'Run With Powershell'

    Code here:
    Code:
    gzip *
    
    get-childitem *.gz | foreach { rename-item $_ $_.Name.Replace(".dat", "") }

    Now this presumes of course that you're using Windows and have GZip (Link) installed. You also need to add C:\Program Files (x86)\GnuWin32\bin to your 'Path' environmental variable




    Thanks
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member
    Join Date
    Mar 2016
    Posts
    362
    Thanks given
    102
    Thanks received
    24
    Rep Power
    60
    what about the ren command from windows?

    i misread the OP lol, for gzipping ren won't work. it will work for the other way round once gzipped files are extracted though

    not a bad way of doing it no, fair play to you
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    May 2011
    Posts
    129
    Thanks given
    8
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by ventusX View Post
    what about the ren command from windows?
    Why in the world would you use that while Powershell is available on any Windows computer. It's much more efficient.
    Reply With Quote  
     

  5. #4  
    Banned

    Join Date
    Jun 2013
    Posts
    499
    Thanks given
    119
    Thanks received
    70
    Rep Power
    0
    Quote Originally Posted by ELKAY View Post
    Why in the world would you use that while Powershell is available on any Windows computer. It's much more efficient.
    Windows based computers also have Command Prompt/CMD, can also use .bat files to run commands..
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    May 2011
    Posts
    129
    Thanks given
    8
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by A NULL View Post
    Windows based computers also have Command Prompt/CMD, can also use .bat files to run commands..
    Are you actually without sarcasm telling me this? I'm a sysadmin so I do know that, obviously. I'm just saying Powershell is more efficient and easier to do advanced commands. to do this in CMD would take a longer time and more 'script'.

    I was simply appreciating OP's input, while the first reply was useless.
    Reply With Quote  
     

  7. #6  
    Banned

    Join Date
    Jun 2013
    Posts
    499
    Thanks given
    119
    Thanks received
    70
    Rep Power
    0
    Quote Originally Posted by ELKAY View Post
    Are you actually without sarcasm telling me this? I'm a sysadmin so I do know that, obviously. I'm just saying Powershell is more efficient and easier to do advanced commands. to do this in CMD would take a longer time and more 'script'.

    I was simply appreciating OP's input, while the first reply was useless.
    You have to acknowledge the fact that you are in-fact s sysadmin, the typical user may find it easier to launch a simple bat file rather then powershell, most people would understand how to launch a powershell basec script after one try, however most people here can't get code handed too them to work..
    Reply With Quote  
     

  8. #7  
    Registered Member
    Join Date
    May 2011
    Posts
    129
    Thanks given
    8
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by A NULL View Post
    You have to acknowledge the fact that you are in-fact s sysadmin, the typical user may find it easier to launch a simple bat file rather then powershell, most people would understand how to launch a powershell basec script after one try, however most people here can't get code handed too them to work..
    Okay I can get on level with you but if you can't use basic scripts, how are you going to use any Java code?

    Someone would still have to make a whole batch script for it, though..
    Reply With Quote  
     

  9. #8  
    Banned

    Join Date
    Jun 2013
    Posts
    499
    Thanks given
    119
    Thanks received
    70
    Rep Power
    0
    Quote Originally Posted by ELKAY View Post
    Okay I can get on level with you but if you can't use basic scripts, how are you going to use any Java code?

    Someone would still have to make a whole batch script for it, though..
    Don't ask me that, ask 80% of the people hosting their shit leeches nowadays
    Reply With Quote  
     

  10. #9  
    Registered Member
    Join Date
    Mar 2016
    Posts
    362
    Thanks given
    102
    Thanks received
    24
    Rep Power
    60
    Quote Originally Posted by ELKAY View Post
    Are you actually without sarcasm telling me this? I'm a sysadmin so I do know that, obviously. I'm just saying Powershell is more efficient and easier to do advanced commands. to do this in CMD would take a longer time and more 'script'.

    I was simply appreciating OP's input, while the first reply was useless.
    you're a sysadmin that doesn't know that the ren command is barely one line of code to change the extensions of an entire folder.... and when setup takes less then 15 seconds. that's hilarious...

    Code:
    ren * *.gzip
    but to correct myself, ren won't do this properly as gzipping is a different subject, not sure why I mentioned it as it's not the right way to do it but I clearly misunderstood the OP. you on the other hand.. you're a dumbass.
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    May 2011
    Posts
    129
    Thanks given
    8
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by ventusX View Post
    you're a sysadmin that doesn't know that the ren command is barely one line of code to change the extensions of an entire folder.... and when setup takes less then 15 seconds. that's hilarious...

    Code:
    ren * *.gzip
    but to correct myself, ren won't do this properly as gzipping is a different subject, not sure why I mentioned it as it's not the right way to do it but I clearly misunderstood the OP. you on the other hand.. you're a dumbass.
    I am the dumbass, ofcourse. He's sharing this because he knew that people may need this. Y'all replying with useless statements and now I am the dumbass for saying Powershell is more efficient and in this case the best way.

    Have a good one sir, i never ment any harm. No idea why you do.

    Kind regards,
    Dumbass

    Quote Originally Posted by A NULL View Post
    Don't ask me that, ask 80% of the people hosting their shit leeches nowadays
    Fair enough, sir.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 0
    Last Post: 01-25-2017, 03:26 AM
  2. Replies: 2
    Last Post: 07-06-2016, 01:53 PM
  3. .dat file Gzip and Unzip
    By PAROGA in forum Tutorials
    Replies: 1
    Last Post: 06-05-2016, 02:49 PM
  4. Replies: 11
    Last Post: 05-21-2010, 03:17 PM
  5. How to add and remove Npc's
    By owner josh in forum Tutorials
    Replies: 13
    Last Post: 10-26-2009, 10:07 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •