Python Forum
count every 28 files and find desire files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
count every 28 files and find desire files
#1
hi
i need a code to get first file (after sorting files in folder) then count every 24 files index from that, pick them up then save them in another folder
in other word filter and select files with 24 times index from first file index in folder and delete others
Reply
#2
what have you tried?
Show your code, working or not.
Reply
#3
import os
path_of_the_directory = 'd:\m'
ext = ('.eof')
for files in os.listdir(path_of_the_directory):
    if files.endswith(ext):
          subindex = 0
          subindex = subindex + 24
          sorted(file_list)
        
    else:
.....
Larz60+ write Dec-12-2021, 08:45 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply
#4
Use the python button to insert your code (and not just with a small snippet.)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Loop through directories and files one level down? Winfried 3 172 Apr-28-2024, 02:31 PM
Last Post: Gribouillis
  Loop through all files in a directory? Winfried 10 462 Apr-23-2024, 07:38 PM
Last Post: FortuneCoins
Question Right way to open files with different encodings? Winfried 2 268 Apr-23-2024, 05:50 PM
Last Post: snippsat
  Open files in an existing window instead of new Kostov 2 345 Apr-13-2024, 07:22 AM
Last Post: Kostov
  Using zipfile module - finding folders not files darter1010 2 294 Apr-06-2024, 07:22 AM
Last Post: Pedroski55
  Is it possible to extract 1 or 2 bits of data from MS project files? cubangt 8 1,086 Feb-16-2024, 12:02 AM
Last Post: deanhystad
  File loop curiously skipping files - FIXED mbk34 10 865 Feb-10-2024, 07:08 AM
Last Post: buran
  Copy Paste excel files based on the first letters of the file name Viento 2 466 Feb-07-2024, 12:24 PM
Last Post: Viento
  Class test : good way to split methods into several files paul18fr 4 503 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  uploading files from a ubuntu local directory to Minio storage container dchilambo 0 479 Dec-22-2023, 07:17 AM
Last Post: dchilambo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020