File size: 14,582 Bytes
4208554
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "98d41525-a191-4a82-a1d2-9caabdf97dd8",
   "metadata": {},
   "source": [
    "# 分散到三个目录"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b775bb87-1ee2-4b3c-ac8b-745a1d4254e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'/group_share/lora-scripts/train3/data/caching_latent/a': ['1_ amiya_(arknights)',\n",
       "  '1_ aurora_(arknights)',\n",
       "  '1_ blue_poison_(arknights)',\n",
       "  '1_ ceobe_(arknights)',\n",
       "  '1_ dorothy_(arknights)',\n",
       "  '1_ exusiai_(arknights)',\n",
       "  '1_ feater_(arknights)',\n",
       "  '1_ gavial_(arknights)',\n",
       "  \"1_ ho'olheyak_(arknights)\",\n",
       "  '1_ jessica_(arknights)',\n",
       "  '1_ la_pluma_(summer_flowers)_(arknights)',\n",
       "  '1_ ling_(arknights)',\n",
       "  '1_ mountain_(arknights)',\n",
       "  '1_ mudrock_(silent_night)_(arknights)',\n",
       "  '1_ nearl_(arknights)',\n",
       "  '1_ originium_arts_(arknights)',\n",
       "  '1_ platinum_(arknights)',\n",
       "  '1_ projekt_red_(arknights)',\n",
       "  '1_ rhodes_island_logo_(arknights)',\n",
       "  '1_ saga_(arknights)',\n",
       "  '1_ schwarz_(arknights)',\n",
       "  '1_ skadi_(elite_ii)_(arknights)',\n",
       "  '1_ specter_(arknights)',\n",
       "  '1_ surtr_(colorful_wonderland)_(arknights)',\n",
       "  '1_ suzuran_(arknights)',\n",
       "  '1_ texas_(arknights)',\n",
       "  '1_ tomimi_(arknights)',\n",
       "  '1_ virtuosa_(arknights)',\n",
       "  '1_mizuki_(arknights)',\n",
       "  '20_ absinthe_(arknights)',\n",
       "  '20_ angelina_(summer_flower)_(arknights)',\n",
       "  '20_ beanstalk_(arknights)',\n",
       "  '20_ ceobe_(unfettered)_(arknights)',\n",
       "  '20_ choshanland_plushy_(arknights)',\n",
       "  '20_ dusk_(everything_is_a_miracle)_(arknights)',\n",
       "  '20_ fartooth_(arknights)',\n",
       "  '20_ frostnova_(arknights)',\n",
       "  '20_ grani_(arknights)',\n",
       "  '20_ horn_(arknights)',\n",
       "  '20_ istina_(arknights)',\n",
       "  '20_ lappland_(refined_horrormare)_(arknights)',\n",
       "  '20_ meteor_(arknights)',\n",
       "  '20_ nearl_the_radiant_knight_(arknights)',\n",
       "  '20_ perfumer_(arknights)',\n",
       "  '20_ reed_the_flame_shadow_(arknights)',\n",
       "  '20_ shamare_(arknights)',\n",
       "  '20_ sideroca_(light_breeze)_(arknights)',\n",
       "  '20_ skyfire_(arknights)',\n",
       "  '20_ suzuran_(yukibare)_(arknights)',\n",
       "  '20_ typhon_(arknights)',\n",
       "  '20_ viviana_(arknights)',\n",
       "  '20_ whisperain_(arknights)',\n",
       "  '20_la_pluma_(arknights)_new',\n",
       "  '40_ ambriel_(arknights)',\n",
       "  '40_ andreana_(arknights)',\n",
       "  '40_ asbestos_(arknights)',\n",
       "  '40_ beanstalk_(gift_uncompleted)_(arknights)',\n",
       "  '40_ carnelian_(shimmering_dew)_(arknights)',\n",
       "  \"40_ ch'en_the_holungday_(elite_ii)_(arknights)\",\n",
       "  '40_ dobermann_(arknights)',\n",
       "  '40_ eyjafjalla_the_hvit_aska_(arknights)',\n",
       "  '40_ flamebringer_(arknights)',\n",
       "  '40_ gravel_(modeling_night)_(arknights)',\n",
       "  '40_ hibiscus_(arknights)',\n",
       "  '40_ hoshiguma_(ronin_huntress)_(arknights)',\n",
       "  '40_ jaye_(arknights)',\n",
       "  '40_ kroos_the_keen_glint_(arknights)',\n",
       "  '40_ leizi_(arknights)',\n",
       "  '40_ mayer_(arknights)',\n",
       "  \"40_ meteor_(bard's_holiday)_(arknights)\",\n",
       "  '40_ mon3tr_(arknights)',\n",
       "  '40_ mousse_(arknights)',\n",
       "  '40_ penance_(occasionally_flushed)_(arknights)',\n",
       "  '40_ pinecone_(sing_a_song)_(arknights)',\n",
       "  '40_ pozyomka_(snowy_plains_in_words)_(arknights)',\n",
       "  '40_ rockrock_(arknights)',\n",
       "  '40_ savage_(arknights)',\n",
       "  '40_ shining_(silent_night)_(arknights)',\n",
       "  '40_ sora_(arknights)',\n",
       "  '40_ talulah_(arknights)',\n",
       "  '40_ tuye_(arknights)',\n",
       "  '40_ waai_fu_(arknights)'],\n",
       " '/group_share/lora-scripts/train3/data/caching_latent/b': ['1_ angelina_(arknights)',\n",
       "  '1_ bagpipe_(arknights)',\n",
       "  '1_ blue_poison_(shoal_beat)_(arknights)',\n",
       "  \"1_ ch'en_(arknights)\",\n",
       "  '1_ dusk_(arknights)',\n",
       "  '1_ eyjafjalla_(arknights)',\n",
       "  '1_ fiammetta_(arknights)',\n",
       "  '1_ goldenglow_(arknights)',\n",
       "  '1_ hoshiguma_(arknights)',\n",
       "  \"1_ kal'tsit_(arknights)\",\n",
       "  '1_ lappland_(arknights)',\n",
       "  '1_ magallan_(arknights)',\n",
       "  '1_ mudrock_(arknights)',\n",
       "  '1_ muelsyse_(arknights)',\n",
       "  '1_ nian_(arknights)',\n",
       "  '1_ penance_(arknights)',\n",
       "  '1_ pozyomka_(arknights)',\n",
       "  '1_ ptilopsis_(arknights)',\n",
       "  '1_ rosa_(arknights)',\n",
       "  '1_ saileach_(arknights)',\n",
       "  '1_ siege_(arknights)',\n",
       "  '1_ skadi_(waverider)_(arknights)',\n",
       "  '1_ specter_the_unchained_(arknights)',\n",
       "  '1_ surtr_(liberte_echec)_(arknights)',\n",
       "  '1_ suzuran_(spring_praise)_(arknights)',\n",
       "  '1_ texas_(willpower)_(arknights)',\n",
       "  '1_ utage_(arknights)',\n",
       "  '1_ w_(arknights)',\n",
       "  '1_multiple_girls',\n",
       "  '20_ amiya_(guard)_(arknights)',\n",
       "  '20_ archetto_(arknights)',\n",
       "  '20_ beeswax_(arknights)',\n",
       "  \"20_ ch'en_(ageless_afterglow)_(arknights)\",\n",
       "  '20_ degenbrecher_(arknights)',\n",
       "  '20_ elite_ii_(arknights)',\n",
       "  '20_ flametail_(arknights)',\n",
       "  '20_ gavial_the_invincible_(arknights)',\n",
       "  '20_ gummy_(arknights)',\n",
       "  '20_ ifrit_(arknights)',\n",
       "  '20_ kjera_(arknights)',\n",
       "  '20_ liskarm_(arknights)',\n",
       "  '20_ mudrock_(obsidian)_(arknights)',\n",
       "  '20_ originium_(arknights)',\n",
       "  '20_ plume_(arknights)',\n",
       "  '20_ robin_(arknights)',\n",
       "  '20_ shining_(arknights)',\n",
       "  '20_ silence_(arknights)',\n",
       "  \"20_ surtr's_golem_(arknights)\",\n",
       "  '20_ texas_(winter_messenger)_(arknights)',\n",
       "  '20_ vermeil_(arknights)',\n",
       "  '20_ warfarin_(arknights)',\n",
       "  '20_ zima_(arknights)',\n",
       "  '20_talulah_(arknights)',\n",
       "  '40_ amiya_(guard)_(touch_the_stars)_(arknights)',\n",
       "  '40_ ansel_(arknights)',\n",
       "  '40_ astesia_(starseeker)_(arknights)',\n",
       "  '40_ beeswax_(weisser_sand)_(arknights)',\n",
       "  '40_ ceobe_(summer_flowers)_(arknights)',\n",
       "  '40_ cliffheart_(arknights)',\n",
       "  '40_ ebenholz_(arknights)',\n",
       "  '40_ female_tourist_c_(arknights)',\n",
       "  '40_ goldenglow_(maiden_for_the_bright_night)_(arknights)',\n",
       "  '40_ heavyrain_(arknights)',\n",
       "  '40_ hibiscus_the_purifier_(arknights)',\n",
       "  '40_ hung_(arknights)',\n",
       "  '40_ jessica_the_liberated_(arknights)',\n",
       "  '40_ lava_(arknights)',\n",
       "  '40_ lumen_(arknights)',\n",
       "  '40_ melantha_(arknights)',\n",
       "  '40_ mint_(arknights)',\n",
       "  '40_ morte_(arknights)',\n",
       "  '40_ nightingale_(arknights)',\n",
       "  '40_ perlica_(arknights)',\n",
       "  '40_ platinum_(shimmering_dew)_(arknights)',\n",
       "  '40_ provence_(arknights)',\n",
       "  '40_ rope_(arknights)',\n",
       "  '40_ scene_(arknights)',\n",
       "  '40_ silverash_(arknights)',\n",
       "  '40_ suzuran_(lostlands_flowering)_(arknights)',\n",
       "  '40_ tequila_(arknights)',\n",
       "  '40_ utage_(disguise)_(arknights)',\n",
       "  '40_ whisperain_(tremble_cold)_(arknights)'],\n",
       " '/group_share/lora-scripts/train3/data/caching_latent/c': ['1_ astesia_(arknights)',\n",
       "  '1_ blaze_(arknights)',\n",
       "  '1_ carnelian_(arknights)',\n",
       "  \"1_ ch'en_the_holungday_(arknights)\",\n",
       "  '1_ eunectes_(arknights)',\n",
       "  '1_ eyjafjalla_(summer_flower)_(arknights)',\n",
       "  '1_ frostleaf_(arknights)',\n",
       "  '1_ gravel_(arknights)',\n",
       "  '1_ irene_(arknights)',\n",
       "  '1_ la_pluma_(arknights)',\n",
       "  '1_ lin_(arknights)',\n",
       "  '1_ mostima_(arknights)',\n",
       "  '1_ mudrock_(elite_ii)_(arknights)',\n",
       "  '1_ myrtle_(arknights)',\n",
       "  '1_ nian_(unfettered_freedom)_(arknights)',\n",
       "  '1_ pinecone_(arknights)',\n",
       "  '1_ pramanix_(arknights)',\n",
       "  '1_ reed_(arknights)',\n",
       "  '1_ rosmontis_(arknights)',\n",
       "  '1_ saria_(arknights)',\n",
       "  '1_ skadi_(arknights)',\n",
       "  '1_ skadi_the_corrupting_heart_(arknights)',\n",
       "  '1_ surtr_(arknights)',\n",
       "  '1_ sussurro_(arknights)',\n",
       "  '1_ swire_(arknights)',\n",
       "  '1_ texas_the_omertosa_(arknights)',\n",
       "  '1_ utage_(summer_flowers)_(arknights)',\n",
       "  '1_ whislash_(arknights)',\n",
       "  '1_shu_(arknights)',\n",
       "  '20_ angelina_(distinguished_visitor)_(arknights)',\n",
       "  '20_ bagpipe_(queen_no._1)_(arknights)',\n",
       "  '20_ blemishine_(arknights)',\n",
       "  '20_ chong_yue_(arknights)',\n",
       "  '20_ doctor_(arknights)',\n",
       "  '20_ eunectes_(forgemaster)_(arknights)',\n",
       "  '20_ franka_(arknights)',\n",
       "  '20_ gladiia_(arknights)',\n",
       "  '20_ harmonie_(arknights)',\n",
       "  '20_ indigo_(arknights)',\n",
       "  '20_ kroos_(arknights)',\n",
       "  '20_ manticore_(arknights)',\n",
       "  '20_ mulberry_(arknights)',\n",
       "  '20_ pallas_(arknights)',\n",
       "  '20_ projekt_red_(light_breeze)_(arknights)',\n",
       "  '20_ saria_(the_law)_(arknights)',\n",
       "  '20_ sideroca_(arknights)',\n",
       "  '20_ skadi_the_corrupting_heart_(sublimation)_(arknights)',\n",
       "  '20_ sussurro_(summer_flower)_(arknights)',\n",
       "  '20_ thorns_(arknights)',\n",
       "  '20_ vigna_(arknights)',\n",
       "  '20_ weedy_(arknights)',\n",
       "  '20_blue_poison_(arknights)_new',\n",
       "  '20_theresa_(arknights)',\n",
       "  '40_ amiya_(newsgirl)_(arknights)',\n",
       "  '40_ april_(arknights)',\n",
       "  '40_ aurora_(elite_ii)_(arknights)',\n",
       "  '40_ cardigan_(arknights)',\n",
       "  '40_ ceylon_(arknights)',\n",
       "  '40_ croissant_(arknights)',\n",
       "  '40_ executor_(arknights)',\n",
       "  '40_ firewatch_(arknights)',\n",
       "  '40_ goldenglow_(summer_flowers)_(arknights)',\n",
       "  '40_ heidi_(arknights)',\n",
       "  '40_ highmore_(arknights)',\n",
       "  '40_ irene_(voyage_of_feathers)_(arknights)',\n",
       "  '40_ kirin_r_yato_(arknights)',\n",
       "  '40_ lee_(arknights)',\n",
       "  '40_ matterhorn_(arknights)',\n",
       "  '40_ metal_crab_(arknights)',\n",
       "  '40_ mlynar_(arknights)',\n",
       "  '40_ mostima_(spellbreaker)_(arknights)',\n",
       "  '40_ passenger_(arknights)',\n",
       "  '40_ phantom_(arknights)',\n",
       "  '40_ podenco_(arknights)',\n",
       "  '40_ roberta_(arknights)',\n",
       "  '40_ rosa_(masterpiece)_(arknights)',\n",
       "  '40_ shaw_(arknights)',\n",
       "  '40_ snowsant_(arknights)',\n",
       "  '40_ swire_the_elegant_wit_(arknights)',\n",
       "  '40_ tomimi_(silent_night)_(arknights)',\n",
       "  '40_ w_(wanted)_(arknights)',\n",
       "  '40_ines_(arknights)']}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "import shutil\n",
    "\n",
    "# Define the source directory and target directories\n",
    "source_dir = '/group_share/lora-scripts/train3/data/arknight_0525'\n",
    "target_dirs = ['/group_share/lora-scripts/train3/data/caching_latent/a', '/group_share/lora-scripts/train3/data/caching_latent/b', '/group_share/lora-scripts/train3/data/caching_latent/c']\n",
    "\n",
    "# Create the target directories if they do not exist\n",
    "for target_dir in target_dirs:\n",
    "    os.makedirs(target_dir, exist_ok=True)\n",
    "\n",
    "# List all directories in the source directory\n",
    "directories = [d for d in os.listdir(source_dir) if os.path.isdir(os.path.join(source_dir, d))]\n",
    "\n",
    "# Group directories in sets of three and distribute them to target directories\n",
    "for i, directory in enumerate(directories):\n",
    "    target_dir = target_dirs[i % len(target_dirs)]\n",
    "    source_path = os.path.join(source_dir, directory)\n",
    "    target_path = os.path.join(target_dir, directory)\n",
    "    shutil.move(source_path, target_path)\n",
    "\n",
    "# Verify the result by listing the contents of each target directory\n",
    "result = {target_dir: os.listdir(target_dir) for target_dir in target_dirs}\n",
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "08c84aa8-553a-44d4-846f-2d6b5c78faa4",
   "metadata": {},
   "source": [
    "# 移回原来的目录"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1a19da33-a094-4f8e-8b25-32a697b9b993",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import shutil\n",
    "\n",
    "# Define the source directory and target directories\n",
    "source_dir = '/mnt/data/source'\n",
    "target_dirs = ['/mnt/data/root/a', '/mnt/data/root/b', '/mnt/data/root/c']\n",
    "\n",
    "# Move the directories back to the source directory\n",
    "for target_dir in target_dirs:\n",
    "    for item in os.listdir(target_dir):\n",
    "        source_path = os.path.join(target_dir, item)\n",
    "        target_path = os.path.join(source_dir, item)\n",
    "        shutil.move(source_path, target_path)\n",
    "\n",
    "# Verify the result by listing the contents of the source directory\n",
    "result = os.listdir(source_dir)\n",
    "result\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}