<jupyter_start><jupyter_text>PORTFOLIO_SCRAPING_EHD_RENAME_AND_MOVE<jupyter_code>ehd = 'EHD_8'
file_to_flatten = 'EHD_7'
directory_in_str = '/Volumes/{}/{}/'.format(ehd, file_to_flatten)
destination = '/Volumes/{}/{}/{}_ALL/'.format(ehd, file_to_flatten, file_to_flatten)

print(directory_in_str, destination)
# # BEFORE
# directory_in_str = '/Volumes/EHD_7/__pre2011/'
# destination = '/Volumes/EHD_7/__pre2011/__pre2011_ALL/'
# import os, time, shutil

# ## NOTE: Don't forget to make the _ALL folder within the file_to_flatten directory

# ehd = 'EHD_8_TOSHIBA_EXT'
# file_to_flatten = 'EHD_7'
# directory_in_str = '/Volumes/{}/{}/'.format(ehd, file_to_flatten)
# destination = '/Volumes/{}/{}/{}_ALL/'.format(ehd, file_to_flatten, file_to_flatten)


# for subdir, dirs, files in os.walk(directory_in_str):
#     for file in files:
#         filepath = subdir + os.sep + file
        
#         time_stamp = 'no_ts_'

#         try:
#             stat = os.stat(filepath)
#             time_stamp = time.strftime('%Y-%m-%d', time.localtime(stat.st_birthtime))
#         except:
#             print('----',stat.st_mtime)
        

        
#         try:
#             newname = filepath.split(directory_in_str)[1].replace('/', '__')
#             newfilename = time_stamp + '_' + newname[-100:] + '__' +file
#             newpath = destination + newfilename
# #             print(len(newfilename), file)
#             shutil.move(filepath, newpath)
# #             print(filepath, newpath)
#         except Exception as e:
#             print(e)
print(directory_in_str)
for subdir, dirs, files in os.walk(directory_in_str):
    for file in files:
        print(file)
testing = 'thisisaverylongtextstring'
testing[-100:]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1449771689497717, 'fraction_numerical': 0.014269406392694063, 'mean_word_length': 3.0578703703703702, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '118724', 'license': 'MIT', 'n_tokens_mistral': 659, 'n_tokens_neox': 644, 'n_words': 105, 'path': '_pages/projects/EHD/PORTFOLIO_SCRAPING_EHD_RENAME_AND_MOVE_i2_shortFileNames.ipynb', 'repo_name': 'dskw1/dskw1.github.io', 'size': '1752'}