Skip to content

Instantly share code, notes, and snippets.

@Tony3-sec
Created January 18, 2017 14:42
Show Gist options
  • Select an option

  • Save Tony3-sec/6c2612eb5e2cb39f1ee4799913259ff2 to your computer and use it in GitHub Desktop.

Select an option

Save Tony3-sec/6c2612eb5e2cb39f1ee4799913259ff2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import os
import glob
org_ext = '.flow'
new_ext = '.pcap'
print('changing file extension ' + str(org_ext) + ' to ' + str(new_ext) + '...')
## list the file with certain extension in current directory
files = glob.glob('*' + str(org_ext))
## Rename files with new extension
for oldname in files:
newname = oldname.replace(org_ext, new_ext)
os.rename(oldname, newname)
print('Completed!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment